uk.ac.man.cs.rainbow.compiler
Class RainbowToRASM

java.lang.Object
  |
  +--uk.ac.man.cs.rainbow.Compiler
        |
        +--uk.ac.man.cs.rainbow.compiler.RainbowToRASM

public class RainbowToRASM
extends Compiler

Compiles Rainbow to RASM and RAPA. The debuggging status of instances of this class created with the default constructor is controlled by the boolean system property rainbow.compiler.debug.

See Also:
Boolean.getBoolean(String)

Inner classes inherited from class uk.ac.man.cs.rainbow.Compiler
Compiler.Error, Compiler.Errors, Compiler.Exception, Compiler.ParseError, Compiler.PreciseError, Compiler.SemanticError, Compiler.Warning
 
Constructor Summary
RainbowToRASM()
           
RainbowToRASM(boolean mode)
           
 
Method Summary
static Errors errors()
           
static Compiler getInstance()
          Manufacture a standard compiler.
static void main(String[] args)
           
 RASMCode rainbow2code(String rainbow, Hashtable context)
          Compile and assemble Rainbow text into a block of code.
 ProcessTerm rainbow2rapa(String rainbow)
          Compile Rainbow text into a RAPA process term.
 String rainbow2rasm(String rainbow)
          Compile Rainbow text into RASM text.
 String rainbow2rif(String rainbow)
          Convert Rainbow text to RIF text.
 RASMCode rasm2code(String rasm, Hashtable context)
          Assemble RASM text into a code block.
 RASMCode rif2code(String rif, Hashtable context)
          Compile and assemble RIF text into a block of code.
 String rif2rasm(String rif)
          Convert RIF text to RASM text.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RainbowToRASM

public RainbowToRASM(boolean mode)

RainbowToRASM

public RainbowToRASM()
              throws Compiler.Exception
Method Detail

errors

public static Errors errors()

toString

public String toString()
Overrides:
toString in class Object

getInstance

public static Compiler getInstance()
                            throws RainbowException,
                                   Compiler.Exception
Description copied from class: Compiler
Manufacture a standard compiler. The name of the compiler to manufacture is given by the rainbow.compiler.class system property, and it must be a subclass of this class. If that property is unspecified, an instance of the default of JSCompiler is provided. The class must have a no-argument constructor.
Following copied from class: uk.ac.man.cs.rainbow.Compiler
Returns:
A compiler object.
Throws:
RainbowException - If things go wrong during compiler creation. Usually because of a bad compiler specification.

rainbow2code

public RASMCode rainbow2code(String rainbow,
                             Hashtable context)
                      throws Compiler.Exception
Description copied from class: Compiler
Compile and assemble Rainbow text into a block of code.
Overrides:
rainbow2code in class Compiler
Following copied from class: uk.ac.man.cs.rainbow.Compiler
Parameters:
rainbow - The Rainbow text to convert.
context - The library context to assemble in.
Returns:
A block of RASM code.
Throws:
IOException - If some external I/O access fails unexpectedly.
RainbowException - If some internal error happens in the compilation or assembly stages.
Compiler.Errors - If there were semantic errors during compilation.
See Also:
Compiler.rainbow2rif(String), Compiler.rif2rasm(String), Compiler.rasm2code(String,Hashtable)

rainbow2rasm

public String rainbow2rasm(String rainbow)
                    throws Compiler.Exception
Description copied from class: Compiler
Compile Rainbow text into RASM text.
Overrides:
rainbow2rasm in class Compiler
Following copied from class: uk.ac.man.cs.rainbow.Compiler
Parameters:
rainbow - The Rainbow text to convert.
Returns:
RASM text suitable for assembly.
Throws:
IOException - If a compiler fails some external I/O access.
RainbowException - If something goes wrong during compilation.
Compiler.Errors - If there were semantic errors during compilation.
See Also:
Compiler.rainbow2rif(String), Compiler.rif2rasm(String)

rasm2code

public RASMCode rasm2code(String rasm,
                          Hashtable context)
                   throws Compiler.Exception
Description copied from class: Compiler
Assemble RASM text into a code block.
Overrides:
rasm2code in class Compiler
Following copied from class: uk.ac.man.cs.rainbow.Compiler
Parameters:
rasm - The RASM text to assemble.
context - The library context to assemble in.
Returns:
A block of RASM code.
Throws:
RainbowException - If the RASM text was ill-formatted, or if anything else unexpected went wrong!
See Also:
RASMCode.RASMCode(Hashtable,BufferedReader,boolean)

rainbow2rif

public String rainbow2rif(String rainbow)
                   throws Compiler.Exception
Description copied from class: Compiler
Convert Rainbow text to RIF text.
Overrides:
rainbow2rif in class Compiler
Following copied from class: uk.ac.man.cs.rainbow.Compiler
Parameters:
rainbow - The Rainbow text to convert.
Returns:
RIF text suitable for the next stage of compilation.
Throws:
RainbowException - If the conversion is impossible for some reason.

rif2code

public RASMCode rif2code(String rif,
                         Hashtable context)
                  throws Compiler.Exception
Description copied from class: Compiler
Compile and assemble RIF text into a block of code.
Overrides:
rif2code in class Compiler
Following copied from class: uk.ac.man.cs.rainbow.Compiler
Parameters:
rif - The RIF text to convert.
context - The library context to assemble in.
Returns:
A block of RASM code.
Throws:
IOException - If some external I/O access fails unexpectedly.
RainbowException - If some internal error happens in the compilation or assembly stages.
Compiler.Errors - If there were semantic errors during compilation.
See Also:
Compiler.rif2rasm(String), Compiler.rasm2code(String,Hashtable)

rif2rasm

public String rif2rasm(String rif)
                throws Compiler.Exception
Description copied from class: Compiler
Convert RIF text to RASM text.
Overrides:
rif2rasm in class Compiler
Following copied from class: uk.ac.man.cs.rainbow.Compiler
Parameters:
rif - The RIF text to convert.
Returns:
RASM text suitable for assembly.
Throws:
IOException - If a compiler fails some external I/O access.
RainbowException - If something goes wrong during compilation.
Compiler.Errors - If there were semantic errors during compilation.

main

public static void main(String[] args)
                 throws ParseException,
                        RainbowException,
                        Compiler.Exception

rainbow2rapa

public ProcessTerm rainbow2rapa(String rainbow)
                         throws RainbowException
Description copied from class: Compiler
Compile Rainbow text into a RAPA process term.
Overrides:
rainbow2rapa in class Compiler
Following copied from class: uk.ac.man.cs.rainbow.Compiler
Parameters:
rainbow - The Rainbow text to convert.
Returns:
A RAPA process term with the calls bound to their definitions.
Throws:
IOException - If some external I/O access fails unexpectedly.
RainbowException - If some internal error happens in the compilation or assembly stages.
Compiler.Errors - If there were semantic errors during compilation.