General HL Semantics
Declarations and Scoping
- HL is statically scoped.
- In each scope, variables must be declared before they are used.
- In each scope, functions must be defined before they are used.
- Each identifier can only be defined once in each scope.
In particular, each function has a single definition in each scope.
Evaluation of Expressions
All expressions in HL should evaluate to a specific value
of one of HL's types.
- Int, boolean, and string literals (constants) evaluate to their value.
- ASTpolyns evaluate to HLpolyns.
Arithmetic expressions with ASTpolyn terms also also evaluated into HLpolyns if possible.
HL typing and
- An identifier will evaluate to its value in the scope in which the evaluation takes place.
This value could be
- A literal of one of HL's types.
- A function definition.
- Identifier should be initialized when they are declared. The initial values are:
- false for bools
- 0 for ints and polyns
- The evaluation of function calls is explained in
- The evaluation of other expressions is explained in
Evaluation of Statements
The evaluation of statements do not yield a value.
Instead statements are executed.
- The evaluation of loops and the stop statement is explained in
The evaluation or function calls and return statements is explained in
- The evaluation of assignments, if statements, and print statements
is the same as other languages and is not explained.
This page is maintained by
Monday, 05-Sep-2016 09:05:03 EDT