home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frozen Fish 1: Amiga
/
FrozenFish-Apr94.iso
/
bbs
/
alib
/
d5xx
/
d512
/
m2pascal.lha
/
M2Pascal
/
M2Pascal.doc
< prev
next >
Wrap
Text File
|
1991-07-20
|
6KB
|
162 lines
OVERVIEW:
This program was developed because of the popularity of pascal and
the lack of a decent pascal compiler for the Amiga. My intent in
writing this program was to help the college student with his projects
by enabling him to use his Modula-2 compiler and all of the advantages
of the language and environment without stepping down to a pascal
compiler.
In theory this is how it work: write the assignment at home with
your Amiga and Modula-2 package and then run it through 'm2pascal'--
presto -- pascal. It's a lot easier then doing it by hand ! Of course
this program is not limited to college students, but keep in mind that
it is intended for short, simple programs.
This work is released to the public-domain and may be modified at will, so
long as it's not sold for profit and my name is keep intact somewhere.
This is the first real program I ever wrote, so it's not written very
well. Scan.mod, for instance, is especially buggy and difficult to
understand.
Because of it's public domain nature there is no warranty, implied
or otherwise. Use at your own risk!
QUICK AND DIRTY:
Nobody likes reading documentation! Here's how to run this program:
****************************
* *
* 1> copy test.mod ram: *
* 1> copy m2pascal ram: *
* *
* 1> m2pascal test.mod * +Make sure test.mod compiles
* * with no errors under
* * Modula-2.
* 1> more test.p * +Set stack to 10000.
* *
****************************
DISCRIPTION:
Commands :
-bn, -bd -> place "begin" on line BELOW statement
example: m2pascal -bd test.mod test.p
-?, -h -> help
example: m2pascal -?
Terminal I/O translation
- Commands beginning with "write" (such as "WriteInt" ) are
translated as the following example shows: The command
on the right is modula-2, the left is pascal.
WriteInt ( number , 1 ) ==> writeln ( number )
- Commands beginning with "Read" ( ReadString, ReadInt etc... )
are are translated as the following example show:
ReadInt ( number ) ==> read ( number )
note: A pascal readln statement might have to be inserted
manually after translating with m2pascal.
- Special note: The benchmark C slash command "\n" is fully
supported. For example:
WriteString("hi\n") ==> write('hi'); writeln;
BUGS/PROBLEMS: ( hey I SAID it was public domain, did you keep the receipt? )
Outputfile ( object file ) destroyed without query. ( scan.mod )
Spaces REQUIRED in INC/DEC/ALLOCATE/DEALLOCATE commands: ( StandardIO.mod )
INC ( i , 1 ) ; works, but INC(i,1,); doesn't
Tabs treated as one space. ( OutModule.mod )
-Tabs don't work correctly in some circumstances. The use of a tab
might cause the output "not to be aligned" with the above line OR
may extend the text beyond the designated line length.
- Running m2detab or a similar tab removable program will solve
the problem.
Doesn't respond well to single statements seperated onto seperate lines.
Multidemensional arrays not supported.
CASE statement not supported. ( process.mod )
- If you have a CASE statement edit the resulting pascal program
as follows:
- Place a 'begin' after all colons.
- If the CASE statement has a default ('ELSE...') option
then erase the 'end' directly before it or your program
will have one too many end's in it.
Do not use the underscore character "_" in variable names if your pascal
compiler doesn't support it.
Do not use empty parenthesis in the declaration of a procedure:
PROCEDURE flag () : BOOLEAN PROCEDURE flag : BOOLEAN;
OR
wrong right
Procedures which contain the keyword 'RETURN' but do not return a value
will be translated incorrectly.
Intended for single pass modula-2 compiler ONLY. ( like benchmark )
- m2pascal will not arrange procedures/functions in your
resulting file to work with a single pass pascal compiler.
Intended for use on syntactically correct modula-2 programs. If there
is an error in your program m2pascal may behave unpredictably.
EXTENSIONS:
Nested functions. Technically this is illegal in Module-2, but maybe
the new standard will support it.
Infinitely many nested comments are accepted. ( The resulting pascal
compiler may not support this. )
The C slash command for a new line ( "\n" ) is understood.
Keyword 'begin' can be put on the line following the command with
the "-bn" command line option:
if a=1 then begin if a=1 then
... OR begin
... ...
end; end;
COMPILATION NOTES NOT USING BENCHMARK:
The only compiler I own is the Benchmark compiler so I have not tried
compiling it with anything else. The source is as generic as possible.
Remember that benchmark allows the underscore char "_" in variable names.
Also remember that the C slash commands are also supported in
benchmark strings (i.e. "\n" ).
AUTHOR:
Greg Mumm
7267 W. Cody Circle
Milwaukee, WI 53223