mirror of
https://github.com/ganelson/inform.git
synced 2024-07-07 17:44:22 +03:00
22 lines
550 B
OpenEdge ABL
22 lines
550 B
OpenEdge ABL
[Interpreting::] Interpreting.
|
|
|
|
Printing out diagrams of the sentences.
|
|
|
|
@ This is where we could put an interpreter or compiler; we now have a nice
|
|
tidy syntax tree to look at. Instead, we'll just print it out.
|
|
|
|
=
|
|
void Interpreting::go(parse_node_tree *syntax_tree) {
|
|
SyntaxTree::traverse(syntax_tree, Interpreting::diagram);
|
|
}
|
|
|
|
int sentence_counter = 1;
|
|
|
|
void Interpreting::diagram(parse_node *p) {
|
|
if (Node::get_type(p) == SENTENCE_NT) {
|
|
LOG("(%d) %W\n\n", sentence_counter++, Node::get_text(p));
|
|
Node::log_subtree(DL, p);
|
|
LOG("\n");
|
|
}
|
|
}
|