Initiating semantic analysis

After successfully calling the parse function, you'll have the root node of the SyntaxTree. It will contain a function with the same name as your start symbol (the first non-terminal defined in the grammar file). Parsing and initiating semantic analysis for our arithmetic example therefore looks like this:

SyntaxTree* root;
if ( parse(filename, input, root) ) {
    int value;
    root.Expr(value);
    writefln("Result: %d", value);
}
else
    writefln("Invalid expression: %s", input);