December 2021
Beginner
840 pages
47h 29m
English
To support conditional evaluation in Camille, we add the following rules to the grammar and corresponding pattern-action rules to the PLY parser generator:
We must also add the if and else keywords to the generator of the scanner on lines 10–16 of the listing at the beginning of Section 10.6.1.
The following code segment of the evaluate_expr function accesses the ntIfElse variant of the abstract-syntax tree of type TreeNode and evaluates the conditional expression it represents: