| Safe Haskell | Safe |
|---|---|
| Language | Haskell2010 |
Sutori.TAC.CodeGen
Description
- addTAC :: TAC -> SutMonad TACAddress
- newLabel :: SutMonad TAC
- genCode :: SutMonad TACTable
- genCodeAST :: Int -> Int -> SutAST -> SutMonad ()
- genCodeInstr :: Int -> Int -> SutInstruction -> SutMonad ()
- genCodeExpr :: SutExpression -> SutMonad TACAddress
Documentation
addTAC :: TAC -> SutMonad TACAddress Source #
Appends to the TAC table a new triplet, references it on the instructions TAC table
Returns the Address of the inserted TAC
TODO: Figure out how to remove duplicated code.
genCode :: SutMonad TACTable Source #
Generates code from the already built mainModule AST
Generates in order: TAC for main/global code, then TACs for each function.
genCodeAST :: Int -> Int -> SutAST -> SutMonad () Source #
Generates code for a block of instructions (AST)
Arguments
| :: Int | Label (ID) pointing to the first instruction in this block |
| -> Int | Label (ID) pointing to the first instruction following this block |
| -> SutInstruction | Currently processing instruction |
| -> SutMonad () |
Generates code for instructions
genCodeExpr :: SutExpression -> SutMonad TACAddress Source #
Generates code for expressions
Each production returns the address (as temporal register) of the resulting expression