Adding semantic and syntactic predicates to LL(k): pred-LL(k) [chapter]

Terence J. Parr, Russell W. Quong
1994 Lecture Notes in Computer Science  
Most language translation problems can be solved with existing LALR(1) or LL(k) language tools; e.g., YACC [Joh78] or ANTLR [PDC92]. However, there are language constructs that defy almost all parsing strategy commonly in use. Some of these constructs cannot be parsed without semantics, such as symbol table information, and some cannot be properly recognized without first examining the entire construct, that is we need "infinite lookahead." In this paper, we introduce a new LL(k) parser
more » ... , pred-LL(k), that uses semantic or syntactic predicates to recognize language constructs when normal deterministic LL(k) parsing breaks down. Semantic predicates indicate the semantic validity of applying a production; syntactic predicates are grammar fragments that describe a syntactic context that must be satisfied before application of an associated production is authorized. Throughout, we discuss the implementation of predicates in ANTLR--the parser generator of The Purdue Compiler-Construction Tool Set.
doi:10.1007/3-540-57877-3_18 fatcat:7ktmzykm3fgozhu3s6no5d45ru