Go to the first, previous, next, last section, table of contents.

Expression Building Blocks

Literal
A literal is a constant value that can be either a number, a character, or a string.
Number | CharLiteral | TextLiteral
Identifier
Identifiers are names given to types, procedures, constants, etc. They consist of a letter followed by one or more letters, digits, and underscores. Modula-3 is case sensitive, so identifiers with the same letters in different cases are different identifiers. Example: test, a_5
Letter { Letter | Digit | "_" ... }
CharLiteral
A character literal represents a single ASCII character (type CHAR). Example: 'A', '\n', '\015'
"'" (PrintingChar | Escape | ") "'"

A PrintingChar is a letter, digit, punctuation mark, or any ISO-Latin-1 code in [ 160..255 ]. An Escape is one of the following:

TextLiteral
A text literal represents a value of type TEXT (a string). Example: "Hello.\n"
" { PrintingChar | Escape | "'" ... } "

PrintingChar and Escape have the same meanings as given above.

Number
A number is an integer or floating point number. Integers can be expressed in any base [2..16] by writing the base followed by "_" and the number in that base. Example: 2_1010 (base 2) = 8_12 (base 8) = 10 (base 10) = 16_A (base 16). Floating point numbers can be expressed in the conventional scientific notation as follows:
Digit { Digit ... } "." Digit { Digit ... } [ Exponent ]
  where
Exponent = "E" | "D" | "X" [ "+" | "-" ] Digit { Digit ... }


Go to the first, previous, next, last section, table of contents.