• Keine Ergebnisse gefunden

THE ALPHA PASCAL COMPILER

Im Dokument Alpha PASCAL (Seite 42-46)

The compiler reads the source program that you have created, and compiles it into three intermediate files that have the same name as the source orogram file and the extensions .P01, .P02, and .P03. These files are used by the linker to create the final, executable program file, which has a .PCF extension. (If .P01, .P02, and .P03 files already exist with the same name as the program, CMPILR deletes them before compiling the new source program. )

To use the compiler, at AMOS command level enter:

PRUN CMPI LR [RET]

The compiler now asks you for the name of the source file:

AlphaPascal V2.0 Source file name?

Enter the name of the file that contains the program or module you want to compi le followed by a RETURN. (CMPILR assumes the .PAS extension.) This source file may be in any account, but the .P01, .P02, and .PO~ files for the program will be generated in the device and account you are logged into.

(Changed 30 April 1981)

I

4.3.1 The Diagnostic Display

After you have given CMPILR the name of the source file you want to compile, it asks:

Diagnostic file name «return> for terminal)?

The diagnostic fiLe contains information about the program compilation. You wiLL usually want to see this information on the screen as the compilation proceeds, and therefore will enter a RETURN. If you want this information sent to a file so that you can have a permanent record of the compilation, enter a valid AMOS file specification. For example:

Diagnostic file name «return> for terminal)? DIAG[RET]

The default extension is .LST. The -diagnostic display might look something like this, depending on the program you are compiling:

AlphaPascal Compiler Version 2.0

< 0>---NEWCHECK < 6>----PROGRAM < 10>---16 lines

7.07 seconds, 152.83 lines/minute No compilation errors.

AlphaPascal Compiler Version 2.0

<

6.97 seconds, 155.02 lines/minutes

?Total of 1 compilation errors.

NOTE: If you tell CMPILR to_send the diagnostic display to the terminal screen instead of a-file, CMPILR pauses when an error occurs, and gives yQU

a chance" either to continue or quit. For example:

-<Changed 30 April 1981)

AlphaPascal Compiler Version 2.0

< 0>-PROGRAM MYPROG

VAR Target: REAL;

?Line 1: [INISOPJ 1;1 or 1(1 expec~ed -- inserting Hit RETURN to continue

I • I

,

At this point you may continue the compilation by typing a RETURN, or you may stop the compilation by typing a Control-C (in which case you see the message: ?Compilation aborted>. If an error occurs, CMPILR does not generate the .P01, .P02, and .P03 intermediate files; this is to prevent you from linking a program that contains a compile-time error.

4.3.2 Compiler Options

The AlphaPascal compiler has a number of options available to you. You may select one or more of these options at compile-time by including the appropriate option codes in your program.

You tell the compiler that you want to make an option request by including the symbol S at the front of a program comment followed by the specific option code you want to use. The compiler acts upon the option requests as

it reaches them in the program.

Option codes may be in upper or lower case. No space may separate the left comment delimiter and the option code. For example, {SG-} is valid, but { SG-} is not.

4.3.2.1 The GOTO Options (SG+ and SG-> - The SG+ code tells the compiler to allow use of the GOTO statement; the SG- code tells the compiler to generate an error message if it encounters a GOTO statement. You may use·

these options to turn GOTO recognition on and off within your program. (The compiler uses the SG- option as the default; that is, it does not recognize GOTO statements unless you use the SG+ option in your program.)

4.3.2.2 The Include Option (SI) - The SI code tells include the contents of the specified file in your program.

AMOS file specification. For example:

{SI MACRO.INC}

the compiler to Supply a valid

The default extension is .INC. The $1 option code tells the compiler to physically insert the contents of the specified file into the file being compiled. The insertion takes place at the point of the option request. You may not include any other option codes after the file specification. The

(Changed 30 April 1981)

purpose of the $1 option is to save you from havinq to duplicate frequently used declarations or lines of code.

The include file can contain any valid program elements, as long as those elements can legally be inserted at the pLace in the program where the include file option occurs. (For example, you will not use the $1 option request in a program's variable declaration section to include a file that contains a program header.)

NOTE: You cannot nest include file requests. That is, the include fiLe may not itseLf contain an include fiLe request.

4.3.2.3 The List Options ($L, $L+ and $L-) - The $L option request tells the compiler to send a listing to an AMOS file. (You do not see a program

listing if you do not use the $L option.) Supply a valid AMOS file specification. For example:

{$L DSK1:DIAG(33,2J}

The Lis~ing will now be written to the specified file. The default file extension is .LST. If you do not give a file specification when you use the

$L request, CMPILR creates a listing file bearing the name of your source file and a .LST extension in the account you are logged into.

Of course, you may not create a listing fiLe outside of the project of the account you are logged into. For examole, if you are logged into DSKO:(100,2J and try to create the Listing file DSKO:LIST.LST[200,2J, the AMOS system will respond with a "protection violation" error and abort the compilation because you tried to create the file in an account outside of the 100 project area.

You may again.

section of your

use the codes $L- and $L+ to turn program listing off and back on For example, suppose you have a long program that contains a Large of comment that you don't want in your listing file. At the front source program you might say:

{$L MYPROG}

Directly in front of the section you do not want in your listing, you would pLace:

{$L-}

At the point where you want the listing turned back on again, place:

-($L+}

The compiLer teLls you in the diagnostic dispLay that it is writing a listing fiLe. For exampLe:

(Changed 30 ApriL 1981)

I

I

AlphaPascal Compiler Version 2.0

< 0>

List to LIST

ERR CHECK < 9>----PROGRAM < .13>---20 lines

12.36 seconds, 96.90 lines/minutes No compilation errors.

If you want the listing to appear on your terminal screen, use the device specification TTY:. For example:

{$L TTY:} ELSE WRITELNC'Very good. Correct entry.') END { Main Program }.

On the right you see a listing of the program. The left contains additional information about the program:

Line# - This is the number of the program line on the right-hand side of the display. The rest of the information on this line refers to this program line.

(Changed 30 April 1981)

Im Dokument Alpha PASCAL (Seite 42-46)