kiama.example.oberon0.compiler

object Encoder

[source: kiama/example/oberon0/compiler/Encoder.scala]

object Encoder
extends AnyRef
Build the assembly/RISC code for the program
Method Summary
def EncodeAssignment (targetdes : Desig, exp : Exp, procOrModDecl : Declaration) : Unit
EncodeAssignment
def EncodeIfStmt (condexp : Exp, thenstmts : scala.List[Statement], elsestmts : scala.List[Statement], procOrModDecl : Declaration) : Unit
EncodeIfStmt
def EncodeModule (md : ModuleDecl) : Unit
Encode a module
def EncodeProc (pd : ProcDecl) : Unit
Encode a procedure
def EncodeProcedureCall (desig : Exp, aps : scala.List[Exp], procOrModDecl : Declaration) : Unit
EncodeProcedureCall
def EncodeRead (exp : Exp, procOrModDecl : Declaration) : Unit
EncodeRead
def EncodeStatement (stmt : Statement, procOrModDecl : Declaration) : Unit
Encode a statement
def EncodeWhileStmt (condexp : Exp, bodystmts : scala.List[Statement], procOrModDecl : Declaration) : Unit
EncodeWhileStmt
def EncodeWrite (exp : Exp, procOrModDecl : Declaration) : Unit
EncodeWrite
def EncodeWriteLn (exp : Exp, procOrModDecl : Declaration) : Unit
EncodeWriteLn
def ProcessActualParams (fps : scala.List[Declaration], aps : scala.List[Exp], procOrModDecl : Declaration) : Unit
Encode procedure actual parameters
def processArrayDesig (ad : ArrayDesig, left : Desig, exp : Exp, procOrModDecl : Declaration) : desigResult
Process an array designator
def processBoolExp (exp : Exp, truelbl : Int, negate : Boolean, procOrModDecl : Declaration) : Unit
processBoolExp (saying where to go if true)
def processDesig (des : Desig, procOrModDecl : Declaration) : desigResult
Resolve a designation into a memory address (register contents + offset)
def processIdent (id : Ident, procOrModDecl : Declaration) : desigResult
Process an ident designator
def processNumExp (exp : Exp, procOrModDecl : Declaration) : Byte
Resolve a numeric expression into a register number
def setByteOffsets (obj : Attributable, byteOffset : Int) : Int
For objects which require memory (VarDecls, RefVarDecls and FieldDecls), set byteOffset For module and proc decls, set the total byteSize (re how much stack space required) For procs, also assign a label
Methods inherited from AnyRef
getClass, hashCode, equals, clone, toString, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized
Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf
Class Summary
case class desigResult (val regno : Byte, val offset : Int) extends scala.Product
Return-value of processDesig procedure
Method Details
def setByteOffsets(obj : Attributable, byteOffset : Int) : Int
For objects which require memory (VarDecls, RefVarDecls and FieldDecls), set byteOffset For module and proc decls, set the total byteSize (re how much stack space required) For procs, also assign a label

def EncodeStatement(stmt : Statement, procOrModDecl : Declaration) : Unit
Encode a statement

def EncodeModule(md : ModuleDecl) : Unit
Encode a module

def EncodeProc(pd : ProcDecl) : Unit
Encode a procedure

def processIdent(id : Ident, procOrModDecl : Declaration) : desigResult
Process an ident designator

def processArrayDesig(ad : ArrayDesig, left : Desig, exp : Exp, procOrModDecl : Declaration) : desigResult
Process an array designator

def processDesig(des : Desig, procOrModDecl : Declaration) : desigResult
Resolve a designation into a memory address (register contents + offset)

def processNumExp(exp : Exp, procOrModDecl : Declaration) : Byte
Resolve a numeric expression into a register number

def processBoolExp(exp : Exp, truelbl : Int, negate : Boolean, procOrModDecl : Declaration) : Unit
processBoolExp (saying where to go if true)

def EncodeAssignment(targetdes : Desig, exp : Exp, procOrModDecl : Declaration) : Unit
EncodeAssignment

def EncodeIfStmt(condexp : Exp, thenstmts : scala.List[Statement], elsestmts : scala.List[Statement], procOrModDecl : Declaration) : Unit
EncodeIfStmt

def EncodeWhileStmt(condexp : Exp, bodystmts : scala.List[Statement], procOrModDecl : Declaration) : Unit
EncodeWhileStmt

def EncodeWrite(exp : Exp, procOrModDecl : Declaration) : Unit
EncodeWrite

def EncodeWriteLn(exp : Exp, procOrModDecl : Declaration) : Unit
EncodeWriteLn

def EncodeRead(exp : Exp, procOrModDecl : Declaration) : Unit
EncodeRead

def ProcessActualParams(fps : scala.List[Declaration], aps : scala.List[Exp], procOrModDecl : Declaration) : Unit
Encode procedure actual parameters

def EncodeProcedureCall(desig : Exp, aps : scala.List[Exp], procOrModDecl : Declaration) : Unit
EncodeProcedureCall