avrora.syntax
Class Module

java.lang.Object
  extended byavrora.syntax.Module
All Implemented Interfaces:
Context
Direct Known Subclasses:
RawModule

public class Module
extends java.lang.Object
implements Context

The Module class collects together the instructions and data into an AVR assembly program.


Nested Class Summary
protected  class Module.Seg
           
 
Field Summary
 boolean caseSensitivity
           
 java.util.HashMap constants
           
protected  Module.Seg dataSegment
           
 java.util.HashMap definitions
           
protected  Module.Seg eepromSegment
           
 AVRErrorReporter ERROR
           
 java.util.HashMap labels
           
 Program newprogram
           
protected  Module.Seg programSegment
           
protected  Module.Seg segment
           
 boolean useByteAddresses
           
 
Constructor Summary
Module(boolean cs, boolean ba)
           
 
Method Summary
 void addConstant(AbstractToken name, Expr val)
           
 void addDataBytes(ExprList l)
           
 void addDataDoubleWords(ExprList l)
           
 void addDataWords(ExprList l)
           
 void addDefinition(AbstractToken name, AbstractToken rtok)
           
 void addInstruction(java.lang.String variant, AbstractToken name)
           
 void addInstruction(java.lang.String variant, AbstractToken name, SyntacticOperand o1)
           
 void addInstruction(java.lang.String variant, AbstractToken name, SyntacticOperand o1, SyntacticOperand o2)
           
 void addInstruction(java.lang.String variant, AbstractToken name, SyntacticOperand o1, SyntacticOperand o2, SyntacticOperand o3)
           
 void addLabel(AbstractToken name)
           
 void addQuotedLabel(AbstractToken name)
           
 void addRegisterName(java.lang.String name, AbstractToken reg)
           
 void addVariable(java.lang.String name, int value)
           
static int align(int val, int width)
           
 Program build()
           
 void enterDataSegment()
           
 void enterEEPROMSegment()
           
 void enterProgramSegment()
           
 Register getRegister(AbstractToken tok)
          The getRegister() method resolves a register that may have been renamed earlier in the program.
 int getVariable(AbstractToken tok)
          The getVariable() method looks up the value of a named constant within the current environment and returns its value.
 void includeFile(AbstractToken fname)
           
 SyntacticOperand.Register newOperand(AbstractToken tok)
           
 SyntacticOperand.Expr newOperand(Expr e)
           
 void reserveBytes(Expr e, Expr f)
           
 void setOrigin(Expr.Constant c)
           
protected  void simplify(Item i)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

definitions

public final java.util.HashMap definitions

constants

public final java.util.HashMap constants

labels

public final java.util.HashMap labels

ERROR

public final AVRErrorReporter ERROR

caseSensitivity

public final boolean caseSensitivity

useByteAddresses

public final boolean useByteAddresses

segment

protected Module.Seg segment

programSegment

protected Module.Seg programSegment

dataSegment

protected Module.Seg dataSegment

eepromSegment

protected Module.Seg eepromSegment

newprogram

public Program newprogram
Constructor Detail

Module

public Module(boolean cs,
              boolean ba)
Method Detail

addDefinition

public void addDefinition(AbstractToken name,
                          AbstractToken rtok)

addConstant

public void addConstant(AbstractToken name,
                        Expr val)

enterDataSegment

public void enterDataSegment()

enterProgramSegment

public void enterProgramSegment()

enterEEPROMSegment

public void enterEEPROMSegment()

addDataBytes

public void addDataBytes(ExprList l)

addDataWords

public void addDataWords(ExprList l)

addDataDoubleWords

public void addDataDoubleWords(ExprList l)

setOrigin

public void setOrigin(Expr.Constant c)

reserveBytes

public void reserveBytes(Expr e,
                         Expr f)

includeFile

public void includeFile(AbstractToken fname)
                 throws AbstractParseException
Throws:
AbstractParseException

addInstruction

public void addInstruction(java.lang.String variant,
                           AbstractToken name)

addInstruction

public void addInstruction(java.lang.String variant,
                           AbstractToken name,
                           SyntacticOperand o1)

addInstruction

public void addInstruction(java.lang.String variant,
                           AbstractToken name,
                           SyntacticOperand o1,
                           SyntacticOperand o2)

addInstruction

public void addInstruction(java.lang.String variant,
                           AbstractToken name,
                           SyntacticOperand o1,
                           SyntacticOperand o2,
                           SyntacticOperand o3)

addLabel

public void addLabel(AbstractToken name)

addQuotedLabel

public void addQuotedLabel(AbstractToken name)

build

public Program build()

simplify

protected void simplify(Item i)

addVariable

public void addVariable(java.lang.String name,
                        int value)

addRegisterName

public void addRegisterName(java.lang.String name,
                            AbstractToken reg)

getRegister

public Register getRegister(AbstractToken tok)
Description copied from interface: Context
The getRegister() method resolves a register that may have been renamed earlier in the program.

Specified by:
getRegister in interface Context
Parameters:
tok - the string name of the register or register alias
Returns:
a reference to the Register instance representing the register with the specified name or alias

getVariable

public int getVariable(AbstractToken tok)
Description copied from interface: Context
The getVariable() method looks up the value of a named constant within the current environment and returns its value.

Specified by:
getVariable in interface Context
Parameters:
tok - the name of the variable
Returns:
the value of the variable within the environment

newOperand

public SyntacticOperand.Expr newOperand(Expr e)

newOperand

public SyntacticOperand.Register newOperand(AbstractToken tok)

align

public static int align(int val,
                        int width)