-
Notifications
You must be signed in to change notification settings - Fork 3
Language Semantics
The following summarizes the language rules of Oberon that the LLVM frontend for Oberon is currently checking during semantic analysis.
All names (identifiers) in the same scope must be unique, regardless of whether they refer to constants, types, variables, or procedures. Duplicate declarations must be reported.
The expression must evaluate to a constant.
The expression must be constant and evaluate to a number larger than 0
. The specified type must exist.
A record defines a new scope. The names of the declared record fields must be unique in this scope. The specified types must exist.
The specified types must exist.
A procedure defines a new scope. All names declared in the procedure must be unique in this scope. Formal parameters that have a structured type (ARRAY
or RECORD
) cannot be VAR
-parameters. Values of structured types are always passed by reference.
Expressions must by type-checked and use of invalid types must be reported. Constant expressions must be evaluated.
Both arguments must be INTEGER
values, the result is of type INTEGER
.
Both arguments must have the same type, the result is of type BOOLEAN
.
Arguments must be BOOLEAN
values, the result is of type BOOLEAN
.
Names must be declared before they can be used. Undeclared names must be reported. Oberon follows lexical scoping, i.e., if a name is not declared in the local scope, its enclosing scopes are checked.
If a selector is present, it must be checked that the name refers to either an ARRAY
or RECORD
, respectively. If a selector references a RECORD
-field, existence of this field must be checked. If a selector indexes an ARRAY
-field and the index is given as a constant or constant expression, array bounds must be checked.
The number and types of the actual parameters must match the number and types of the formal parameters. Constant values and expressions cannot be passed as VAR
-parameters. As a default, parameters are passed by value.
The name on the left-hand side of the assignment must refer to a variable. The type of expression that is assigned must be compatible with the type of the variable.
The type of expression representing the condition must of type BOOLEAN
.
The type of expression representing the condition must of type BOOLEAN
.
Building the Frontend
Using the Compiler
- Apple Clang Toolchain
- GCC Toolchain
- Microsoft MSVC Toolchain
- Just-in-Time Compilation
- Embedded Devices
Oberon Compatibility
Miscellaneous