oscript.translator
Class ForLoopStatementTranslator
java.lang.Object
oscript.translator.ForLoopStatementTranslator
- public class ForLoopStatementTranslator
- extends java.lang.Object
A translator to implement one part of the language in terms of another.
This simplifies the compiler/interpreter implementation. This translates
from:
"for" "(" (PreLoopStatement)? ";" (Expression1)? ";" (Expression2)? ")"
EvaluationUnit
to
"{"
(PreLoopStatement)? ";"
"while" "(" Expression1 ")"
"{"
EvaluationUnit
(Expression2)?
"}"
"}"
- Version:
- 0.1
- Author:
- Rob Clark
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ForLoopStatementTranslator
public ForLoopStatementTranslator()
translate
public static Node translate(ForLoopStatement n)
- Convert a
ForLoopStatement
production in the syntaxtree
into an equivalent production.
f0 -> "for"
f1 -> "("
f2 -> ( PreLoopStatement() )?
f3 -> ";"
f4 -> ( Expression() )?
f5 -> ";"
f6 -> ( Expression() )?
f7 -> ")"
f8 -> EvaluationUnit()