sutori-0.2.4: Sutori language compiler

Safe HaskellSafe
LanguageHaskell2010

Sutori.TAC.CodeGen

Description

 

Synopsis

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.

newLabel :: SutMonad TAC Source #

Gets the next label

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)

genCodeInstr Source #

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