|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectautohit.creator.compiler.XmlCompiler
autohit.creator.compiler.SimCompiler
This is the a Sim compiler. It will compile xml documents that conform to the "%autohit.dtd.location%/sim.dtd" dtd into a Sim object.
WARNING!!! For the compiler to work, the sim.dtd must be at the location specified in the system property autohit.dtd.location.
The private methods 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...
Logging will be done to the autohit.creator.sim namespace. It is set for pretty and
EPG - Initial - 14Apr03
EPG - Update to add goto and references - 13Jul03
Field Summary | |
protected java.util.Stack |
fixupstack
Stack for fixups |
protected VMExecutableWrapper |
ob
The work-in-progress object code |
protected java.util.HashMap |
symboltable
Symbol table for lookups |
Fields inherited from class autohit.creator.compiler.XmlCompiler |
myErrorHandler, myLog, runtimeLog |
Fields inherited from interface autohit.creator.SimLanguage |
ATTR_BUFFER, ATTR_CLEAR, ATTR_COUNT, ATTR_EVALUATOR, ATTR_ITEM, ATTR_LABEL, ATTR_LEFT, ATTR_METHOD, ATTR_NAME, ATTR_NEW, ATTR_OPERATOR, ATTR_OUTPUT, ATTR_REFERENCE, ATTR_RESULT, ATTR_TYPE, ATTR_UID, ATTR_VALUE, ATTR_VERSIONNUMBER, cEQ_OPERATION, EQ, EQ_OPERATION, EQ_STRING, GT, GT_STRING, IF_OPERATION, LITERAL_ONE, LITERAL_ZERO, LT, LT_STRING, MINUS_OPERATION, NOT, NOT_STRING, NOT_ZERO, ZERO |
Constructor Summary | |
SimCompiler()
Default Constructor. |
|
SimCompiler(SystemContext sc)
Constructor. |
Method Summary | |
java.lang.Object |
build(org.w3c.dom.Document xd)
Compile the xml tree into an VMExecutable object. |
Methods inherited from class autohit.creator.compiler.XmlCompiler |
compile, numberErrors, numberWarnings, resetRuntimeLog, runtimeDebug, runtimeError, runtimeWarning, setRuntimeLog |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected VMExecutableWrapper ob
protected java.util.HashMap symboltable
protected java.util.Stack fixupstack
Constructor Detail |
public SimCompiler() throws java.lang.Exception
java.lang.Exception
- any exception invalidates the compiler.public SimCompiler(SystemContext sc) throws java.lang.Exception
java.lang.Exception
- any exception invalidates the compiler.Method Detail |
public java.lang.Object build(org.w3c.dom.Document xd)
build
in class XmlCompiler
xd
- A parsed XML document.
VMExecutableWrapper
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |