Modula-2 compiler documentation
Logitech Modula-2/86 Compiler Rel 2.00
This is a high quality compiler that seems to do everything a good Modula-2 compiler should do. The documentation is very complete but is very cryptic and has no definition of the language. Logitech has apparently redone the manual since our copy and it is, according to reports, much better. We have used this compiler to develop a 2000 line program with no problems, so we can recommend it as a learning tool and a production system.
To set up and run this compiler, simply follow the instructions as given in the manual then do the following steps if you want to use floating point numbers. The instructions are buried in the notes and are not clear that this should be done. This will use the emulators for the floating point operations. The method will make it clear how you can use the 8087 libraries if you have them.
In the LNK directory;
- COPY E87REALI.LNK REALINOU.LNK
- COPY E87REALC.LNK REALCONV.LNK
- COPY E87REALS.LNK REALS.LNK
- COPY E87MATH0.LNK MATHLIB0.LNK
In the REF directory;
- COPY E87REALI.REF REALINOU.REF
- COPY E87REALC.REF REALCONV.REF
- COPY E87REALS.REF REALS.REF
- COPY E87MATH0.REF MATHLIB0.REF
----------- Batch file used with the Logitech compiler ----------
REM The next line is a call to your editor
EDIT %1.MOD
M2C %1
IF ERRORLEVEL 1 GOTO ERROR
M2L %1
IF ERRORLEVEL 1 GOTO ERROR
M2 %1
PAUSE
GOTO DONE
:ERROR
REM Compile or Link error
PAUSE
:DONE
--------------------- End of batch file -------------------------
Following are the problems found in compiling the source files on your distribution disk. All other files compile and run exactly as described in the text.
Chapter 3 - INTMATH.MOD Logitech doesn't implement the MIN and MAX functions so you need to erase or comment out lines 34 and 35.
Chapter 3 - CARDMATH.MOD Erase or comment out lines 44 and 45.
Chapter 3 - REALMATH.MOD Erase or comment out lines 43 and 44.
Chapter 7 - OVERPROG.MOD You can add a call to "Proc2" after line 8 because Logitech allows you to call a procedure prior to its being defined.
Chapter 7 - MOREPROG.MOD Same thing, after line 16.
Prior to release of this tutorial, a preliminary copy was sent to Logitech for their comments. Following is an exact copy of their reply to our letter dated April 14, 1987. Since we do not have a copy of the newer version of their compiler, none of the comments in Mr. Cei's letter are acted upon anywhere in this tutorial, but are included for the student's information. It would probably be wise to use the integrated environment provided by Logitech for software development.
(Start of letter from Logitech)to: Coronado Enterprises
12501 COronado Ave NE
Albuquerque, New Mexico 87122re: Modula2 Tutorial by Coronado Enterprises
Dear Sir,
I thank you very much for reviewing the Logitech Modula2 system in your tutorial and for giving me the opportunity to comment on your review. I am sure that the Modula2 will win more and more fans especially if material such as your tutorial is published.
My first comment is that I feel that a discussion about the cur- rent release of the system would be more interesting and effective for your audience. The current release is the 2.05 and it has been shipped since May, 1986. The manual is hopefully better organized and more clear. For instance, you will find a chapter on real arith- metic which talks about the 8087 Coprocessor/Emulator issue and about how to use the related libraries.
Another point I would like to make is that our Modula2 system is an integrated system and not only a compiler. Therefore, a typical user would probably not use a batch file (such as the one you list) to edit, compile and link a program. Since the editor has the capability to syntax-check a M2 program, to invoke the compiler, the linker and to run the program, a user will find it very advantageous to work from within the editor. Available are also valuable tools like a symbolic run-time debugger and a symbolic post-mortem debugger.
Thank you very much for your attention. I will be very pleased of any further discussion.
Sincerely
(Signed)
Stefano Cei
S/W Development Manager(End of letter from Logitech)
FTL Modula-2 Compiler - Version 1.20
The FTL compiler, marketed by Workman & Associates, is a very good implementation of the Modula-2 language. It is extremely fast in compiling and linking, and does everything we have asked it to do. It gives good diagnostics, but since line numbers are not given with error messages, it can be hard to track down an error in a large module. Considering the selling price, it may be the best value in a compiler available on the market. We have not used it for any large programs, but it works fine for all of the files in this tutorial. It is definitely recommended as a learning tool, and we have no reason to not recommend it as a production tool other than the lack of experience in using it.
------------ Batch file used with FTL Modula-2 ---------------
REM The next line is used to call your editor
EDIT %1.MOD
M2 %1.MOD
IF ERRORLEVEL 1 GOTO ERROR
ML %1
IF ERRORLEVEL 1 GOTO ERROR
%1
PAUSE
GOTO DONE
:ERROR
REM COMPILE OR LINK ERROR
PAUSE
:DONE
---------------------End of Batch file ---------------------------
Following are all of the problems we encountered in compiling and running the source files included on the SOURCE disk.
Chapter 3 - REALMATH.MOD
- Line 5, Change MathLib0 to Maths
- Lines 5 & 22, Capitalize SIN & COS
- Comment out lines 43 & 44
Chapter 8 - SIMPLOUT.MOD
- Line 12 - InOut.WriteString ....
- Line 17 - InOut.WriteLn;
- Line 4 - (delete) FTL will not allow both types of IMPORT in one module.
SIMPLIN.MOD
- The input routines work different with FTL than with Logitech. The resolution of the differences will be left to the student.
FILEIO.MOD
- Change the following lines;
- Line 17 - OpenInput("Filename ---> ");
- Line 22 - OpenOutput("Filename ---> ");
- Include the extension when inputting the name.
VARYFILE.MOD
In order to use the "Streams" module, the following changes must be made to the module.
- Line 4 - FROM Streams IMPORT Connect,STREAM, Disconnect,ReadChar,EOS,Direction;
- Line 7 - ... ARRAY[0..13] ...
- Line 8 - InFile : STREAM;
- Line 10 - Reply : INTEGER;
- Line 16 - Reply := Connect(InFile,NameOfFile,input);
- Line 17 - UNTIL Reply = 0;
- Line 21 - IF NOT EOS(InFile)
- Line 24 - UNTIL EOS(InFile);
- Line 25 - Disconnect(InFile,TRUE);
PRINTFLE.MOD
- Modify in the same manner as for VARYFILE.MOD and it will run correctly. The actual mods will be left as an exercise for the student.
Chapter 9 - TIMEDATE.MOD
- Line 10 - FROM MsDos IMPORT Registers,MSDOS;
- Line 17 - Regs : Registers;
- Replace Lines 21 through 30 with;
- Regs.AX := 02A00H; (* code for get date *)
- MSDOS(Regs);
- Year := Regs.CX;
- Month := Regs.DH;
- Day := Regs.DL;
- Regs.AX := 02C00H; (* code for get time *)
- MSDOS(Regs);
- Hour := Regs.CH;
- Minute := Regs.CL;
- Second := Regs.DH;
- Millisecond := 10 * Regs.DL;
AREAS.MOD These three programs don't use anything
PC.MOD that is substantially different from the
LIST.MOD other example programs, so they will be considered as programming exercises for the student if he should desire to attempt to make them work in the FTL system.
Chapter 14 - WORDADDR.MOD
- Line 10 - MonoVideo[0B000H] : ....
- Line 11 - ColorVideo[0B800H] : ....
- Line 30 - (delete) Since FTL uses a small memory model, it will not support this program as written.
ADRSTUFF.MOD
- Since FTL is very picky about TYPES, as it should be, you must do the following conversions;
- Add a new TYPE definition;
- pCARDINAL = POINTER TO CARDINAL;
- Line 29 - NeatPoint := pCARDINAL(CARDINAL(NeatPoint) + IncreAmt);
- Lines 36 & 37 - Do the same TYPE conversions as for Line 29.
Chapter 15 - COROUT.MOD
- Change the SYSTEM imports to read;
- FROM SYSTEM IMPORT WORD, ADR, SIZE;
- FROM Processes IMPORT PROCESS, NEWPROCESS, TRANSFER;
COROUT2.MOD
- Same as for COROUT.MOD
COROUT3.MOD
- Same as for COROUT.MOD
INFINITE.MOD
- Same as for COROUT.MOD
Chapter 16 - None of these files have been compiled with the FTL compiler as of this writing. If you have completed the entire tutorial, you should have no difficulty in making the required changes to these programs in order to use them as usable utility programs.
PCollier Modula-2 Compiler V1.0
Even though this seems to be a working compiler, it does have a few shortcomings. It is too picky about type checking, not allowing type conversion between INTEGER and CARDINAL in the implied type of a FOR loop. The diagnostic messages given are generally not very clear nor is it clear where the problem is. Little effort was spent tracking down all of the problems because we quickly lost interest in this system due to the confusing diagnostic messages.
-------------- Batch file used with PCollier ------------------------
REM The following line is a call to your editor
EDIT %1.MOD
M2PC %1/RN /Z
IF ERRORLEVEL 1 GOTO ERROR
M2X %1
PAUSE
GOTO DONE
:ERROR
REM ERROR FOUND IN COMPILER PASS
PAUSE
:DONE
--------------------- End of batch file -----------------------------
Following are some of the problems encountered in compiling and running the files included on the SOURCE disk.
Chapter 6 - ARAYPASS.MOD Index needs to be a CARDINAL in line 42 but it must be an INTEGER in line 46. The same variable cannot be used in both places without an error. Define a new variable of type CARDINAL for use in lines 42 & 43.
Chapter 6 - STRINGEX.MOD This is an example of a compiler writer defining a Library Module differently from another writer. It will require you to read the documentation and change the procedure calls to those defined by the PCollier writers.
Chapter 9 - None of these files have been compiled or debugged with this compiler. It will be left up to you to debug them if you so choose.
Chapter 10 - SUBRANGE.MOD The diagnostic received here makes no sense.
Chapter 10 - SETS.MOD The diagnostic received here makes no sense.
Chapter 13 - CIRCLES.DEF Remove the EXPORT list. The exporting is done for you automatically.
Chapter 14 - TYPEREL.MOD The type transfer functions do not work the way they should, and the diagnostic messages are unclear.
Chapter 14 - WORDADDR.MOD Remove line 30.
Chapter 14 - ADRSTUFF.MOD The type checking is inconsistent. It is not clear what the problems are that the compiler doesn't like in this file.
Chapter 15 - All Files Modify the IMPORT list as follows;
- FROM SYSTEM IMPORT WORD, ADR;
- FROM Transfer IMPORT PROCESS, NEWPROCESS, TRANSFER;
These changes will still not make the programs work, but they will compile without error. We lack the time and interest to continue debugging.
Chapter 16 - None of these files have been compiled with this compiler as of this writing. If you have completed the entire tutorial, you should be able to make the required changes to these programs in order to use them as utility programs.