Skip to content

Var expression

Arno van der Vegt edited this page Nov 10, 2020 · 1 revision

All code which accesses memory is compiled with the VarExpression class.

The primary function in this class is the compileExpressionToRegister method:

compileExpressionToRegister(identifier, expression, reg, forWriting, selfPointerStackOffset)

This function compiles a given expression to code which calculates the address of the expression.

The parameters of this function are:

  • identifier: The identifier information which is the search result of searching for the first expression lexeme in the active scopp. It can be a variable, procedure or field.
  • expression: The expression to compile.
  • reg: The register in which the resulting offset is stored.
  • forWriting: Is the expression for reading or writing to memory.
  • selfPointerStackOffset: If given then the found object pointer will be stored at this offset on the stack.