oscript.translator
Class CollectionForLoopStatementTranslator
java.lang.Object
oscript.translator.CollectionForLoopStatementTranslator
- public class CollectionForLoopStatementTranslator
- 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 ":" Expression ")"
EvaluationUnit
to
"{"
"var" "$itr$" = "(" Expression ")" "." "iterator" "(" ")" ";"
"while" "(" "$itr$" "." "hasNext" "(" ")" ")"
"{"
PreLoopStatement "=" "$itr$" "." "next" "(" ")" ";"
EvaluationUnit
"}"
"}"
- Version:
- 0.1
- Author:
- Rob Clark
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CollectionForLoopStatementTranslator
public CollectionForLoopStatementTranslator()
translate
public static Node translate(CollectionForLoopStatement n)
- Convert a
CollectionForLoopStatement
production in the syntaxtree
into an equivalent production.
f0 -> "for"
f1 -> "("
f2 -> PreLoopStatement()
f3 -> ":"
f4 -> Expression()
f5 -> ")"
f6 -> EvaluationUnit()