
526 VII 3D Engine Design
TIntermLoop(ELoopWhile)
“while (i < 4) {
…
}”
TIntermBinary(EOpLessan)
…
Condition
Body
Left
TIntermSymbol(“i”) TIntermConstantUnion(4)
Right
Figure 3.1. Exampleofparsingastringintoanabstractsyntaxtree.
makes it relatively easy to update the grammar. The GLSL ES specification
conveniently lists the entire grammar in its appendix. Also, 3DLab’s code was
clearly intended for assembly or binary output, but the AST traverser archi-
tecture is nicely object-oriented to allow for alternative implementations. The
biggest change that was required for outputting a high-level language was to
not just perform an implementation-dependent action ...