Intermediate Representation
The IR is an Abstract Syntax Tree (AST) encapsulated in an ATerm (Annotated Term).
The ATerm data type is agnostic in respect to the meaning of a particular application term. For the IR it was developed a schema that could represent the program, in all its stages from near-Assembly language code to conventional C language code.
This is an excerpt of the IR schema in the Abstract Syntax Description Language (ASDL) -- a domain specific language for describing the abstract syntax of compiler intermediate representations and other tree-like data structures, developed for the Zephyr project:
stmt = Asm(string opcode, expr * operands) tmt | Assign(type, optExpr dest, expr src) | Label(string name) | GoTo(expr addr) | | Break | Continue | Block(stmt*) | If(expr cond, stmt, stmt) | While(expr cond, stmt) | DoWhile(expr cond, stmt) | Ret(type, optExpr value) | Var(type, string name, optExpr value) | Function(type, string name, arg*, stmt* body) | NoStmt ...