Lexical Elements |
1 |
![]() |
Character Set
Pascal uses the standard seven-bit ASCII character set, and the compiler distinguishes between uppercase and lowercase characters. For example, the following seven words are distinct from the predefined type integer:
Integer |
INTEGer |
INteger |
INTEGEr |
INTeger |
INTEGER |
INTEger |
|
If you change the case of characters used in a word, the compiler does not recognize the word and gives an error.
-L |
Maps all uppercase letters in keywords and identifiers to lowercase. |
-s |
Performs the same action as -L and also produces warning diagnostics for nonstandard constructs and extensions. |
See the Pascal 4.2 User's Guide for a complete description of pc and its options.
Special Symbols
Pascal recognizes the following standard Pascal symbols and the nonstandard special symbols listed in Table 1-1.
+ - * / = < > [ ] . , := : ; ( ) <> <= >= .. ^ |
Reserved Words
Pascal reserves the standard words in Table 1-2. You cannot redefine a reserved word to represent another item.
Pascal also reserves the nonstandard words in Table 1-3. These words are not treated as reserved words when you compile your program with any of the -s, -s0, -s1, -V0 or -V1 options.
Pascal Nonstandard Reserved Words | |
define |
private |
extern |
public |
external |
static |
module |
univ |
otherwise |
|
Identifiers
In Pascal, you can include a dollar sign ($) and underscore (_) in an identifier name. The $ and _ can occur in any position of the identifier name. However, you should avoid using these characters in the first position because they may conflict with system names.
You can redefine a predeclared identifier to represent another item. For example, you could redefine the predefined identifier next, a statement that causes the program to skip to the next iteration of the current loop, as a variable.
Comments
In Pascal, you can specify a comment in either braces, quotation marks, a parenthesis/asterisk pair, or a slash/asterisk pair: { This is a comment. }
(* This is a comment. *)
" This is a comment. "
/* This is a comment. */
The symbols used to delimit a comment must match. For example, a comment that starts with { must end with }, and a comment that starts with (* must end with *).{ This is a valid (* comment within a comment. *) }
(* This is a valid " comment within a comment. " *)
You cannot nest the same kind of comments. The following comments result in a compile-time error:{ This is not a valid { comment within a comment. } }
(* This is not a valid (* comment within a comment. *) *)
" This is not a valid " comment within a comment. " "
/* This is not a valid /* comment within a comment. */ */