creator.compiler
Class SimCompiler

java.lang.Object
  |
  +--creator.compiler.XmlCompiler
        |
        +--creator.compiler.SimCompiler

public class SimCompiler
extends XmlCompiler

This is the a Sim compiler. It will compile xml documents that conform to the "%AUTOHIT_ROOT%/lib/sim.dtd" dtd into a Sim object.

WARNING!!! For the compiler to work, the FIRST element of the java CLASSPATH must be the root for the autohit installation. The compiler needs to find the "sim.dtd" file in the "%AUTOHIT_ROOT%/lib" directory.

The private methos translate Token() matches the textual tokens, as defined in the dtd to numerics that are used by the rest of the compiler. Any new tokens need to be added to that method.

I can think of several more elegant approaches to making this compiler, but until the XML parsers settle a bit, I'm not going to bother...

IMPORTANT NOTE!!!! The XML parser WITH DTD ensure instructions are coded in the proper order. ALL of the code below assumes this!!! If instructions come out of order or in disallowed places (like a seek outside of a get), I GUARANTEE you'll get a runaway compiler...,

We will look for imbedded variables only in certain locations.

See Also:
Sim

Field Summary
protected  Sim workingSim
          The work-in-progress Sim object.
 
Fields inherited from class creator.compiler.XmlCompiler
err, parser
 
Constructor Summary
SimCompiler()
          Constructor.
 
Method Summary
 java.lang.Object build(com.sun.xml.tree.XmlDocument xd)
          Compile the xml tree into a Sim object.
 
Methods inherited from class creator.compiler.XmlCompiler
compile
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

workingSim

protected Sim workingSim
The work-in-progress Sim object.
Constructor Detail

SimCompiler

public SimCompiler()
            throws java.lang.Exception
Constructor. This is the only and default constructor.
Throws:
java.lang.Exception - any exception invalidates the compiler.
Method Detail

build

public java.lang.Object build(com.sun.xml.tree.XmlDocument xd)
Compile the xml tree into a Sim object. This method implements the abstract method in XmlCompiler. It will be automatically called after the source document is parsed into an xml tree.
Parameters:
xd - A parsed XML document.
Returns:
a reference to the target object.
Overrides:
build in class XmlCompiler
See Also:
Sim, SimCompiler