During tree traversal, while visiting a node in the tree, the tree walker executes an "action". In our tree walker, an action is a transformation step that goes from AST to an instance of a Java object from our Ctrl model. The action essentially takes node values from the AST and copies them into a RuleStatement. This is what Ctrl compilation comes down to. A few getters and setters were missing, so I added these as well as toString() implementations to all of the Java classes in the model supporting the for loop.
I took a screenshot of my debugging session. The breakpoint in the screenshot is set in my TestRig. Whenever the grammars are touched, I run the TestRig. It is a suite of tests that compiles a wide range of statements in the Ctrl, from simple one-liners, to complex multi-line if-then-else statements.

We are in good shape so far. The screenshot shows a compiled RuleStatement object that contains an initialized ForStatement, in the "Variables" view of the debugger.
No comments:
Post a Comment