January 2013
Intermediate to advanced
328 pages
8h 5m
English
Semantic predicates, {...}?, are Boolean expressions written in the target language that indicate the validity of continuing the parse along the path “guarded” by the predicate. Predicates can appear anywhere within a parser rule just like actions can, but only those appearing on the left edge of alternatives can affect prediction (choosing between alternatives). We discussed predicates in detail in Chapter 11, Altering the Parse with Semantic Predicates. This section provides all of the fine print regarding the use of semantic predicates in parser and lexer rules. Let’s start by digging deeper into how the parser incorporates predicates into parsing decisions.
ANTLR’s general decision-making ...
Read now
Unlock full access