📄 p2m2.l
字号:
.\"#@(#)p2m2.l 4.1 Ultrix 7/17/90.TH P2M2 l "1 February 1984".SH NAMEp2m2 \- Pascal to Modula-2 conversion tool.SH SYNOPSIS.B p2m2[ -h ] [ -s ] name.SH DESCRIPTION.I P2m2is a tool for assisting with the conversion of programs from Berkeley Pascal toModula-2.It does not perform a complete translation, since there are somelanguage features in Pascal that either do not exist in Modula-2 (e.g.,.B gotostatements) or are too difficult to convert(e.g., write statements).It also does not necessarily produce a \*(lqgood\*(rq Modula-2 program,since it does not restructure a program into modules..PPIn spite of these disclaimers, it is possible to use.I p2m2to rapidly convert a substantial amount of Pascal software to Modula-2..PPFiles are converted one at a time.A file name must end with \*(lq.p\*(rq for a Pascal program or separate compilationunit,or with \*(lq.h\*(rq for a set of definitions or external specifications for aseparate compilation unit.A file called \*(lqname.p\*(rq will produce a program or implementation module called\*(lqname\*(rq in a file called \*(lqname.mod\*(rq.A program module will be generated if the file contains a Pascal program.A file called \*(lqname.h\*(rq will produce a definition module called name ina file called \*(lqname.def\*(rq..PPThe .B \-hflag is specified when a separate compilation unit is converted.The option causes.I p2m2to scan the corresponding \*(lq.h\*(rq file for procedure parameter definitions andinsert those in the generated \*(lq.mod\*(rq file.This flag is useful because Berkeley Pascal prohibits parameters fromappearing in the procedure definition if there is an external declaration ofthe procedure..PPThe.B \-sflag outputs reserved words in upper case, in accordance with the Modula-2report.By default,.I p2m2generates reserved words in lower case..SH "METHOD"As.I p2m2parses the Pascal program, it copies white space (comments, spaces, new lines)to the output.It outputs tokens and identifiers, rearranging them as necessary.The result is a program that is formatted approximately the sameas the original..PPThe names of procedures, functions, variables, types, and constants definedin \*(lq.h\*(rq files are exported from the definition module.The names are exported unqualified, to simulate the global naming thattakes place in Berkeley Pascal.(Although the Modula-2 report requires global exports to be qualified,the DEC Modula-2 compiler permits unqualified exports.)An include directive is changed to a comment, but causes the named moduleto be imported..SH "UNHANDLED DIFFERENCES"The following is a partial list of differences between Pascal and Modula-2that are not handled:.LP.I "Forward declarations"are not necessary, since Modula-2 allows procedures to be defined after theyare used..LP.I "Goto statements and label declarations"are not supported.Many goto statements may be avoided by using the.B loopand.B exitor.B returnstatements..LP.I "I/O and files"are different, including write statements.See.IR mod (l)and the standard module.I io.deffor details..LP.I "Procedure parameters"are supported differently.Since Modula-2 supports procedure variables (which may be passed as parameters),the syntax for formal procedure parameters is similar to other formalparameters..LP.I "Function return values"are done through the return statement, not by assignment to the function name.Assignments to functions are marked with the comment (*!return!*) to alloweasy editting in most cases..SH FILES.ta 1.1ifile.p Pascal main program or separate compilation unit.brfile.h Pascal header file.brfile.mod Program or implementation module.brfile.def Definition module.brp2m2.temp Output of first pass of p2m2.SH "SEE ALSO"N. Wirth,.IR "Programming in Modula-2" ,Springer-Verlag, New York, 1982..SH DIAGNOSTICSError messages are written to standard output.In addition, comments are inserted in the generated modules to markplaces where the translation failed.Such comments are of the form (*! ... !*)..SH AUTHORSBenjamin C. Pierce.brMichael L. Powell.brDigital Equipment Corporation.brWestern Research Laboratory.br4410 El Camino Real.brLos Altos, CA 94022.brMail: powell@decwrl.csnet or {decvax,ucbvax}!decwrl!powell.PPSoftware and documentation isCopyright 1984, Digital Equipment Corporation,Maynard, Massachusetts.All rights reserved.This software is provided under license agreement and must be kept confidential..SH LIMITATIONSThis is an experimental tool, and thus no warranties are expressed orimplied about its conformance to the definition of the Modula-2 languageor about its proper functioning.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -