meta data for this page
  •  

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
contextual_predicates [2021/02/08 18:14] revuskycontextual_predicates [2023/03/03 14:23] (current) revusky
Line 1: Line 1:
 ====== Contextual Predicates ====== ====== Contextual Predicates ======
  
-A //contextual predicate// allows you to add conditions at [[choice points]] based on scanning back in the call/lookahead stack. Note that this is a completely new feature in JavaCC 21 that does not exist in the legacy JavaCC tool.+A //contextual predicate// allows you to add conditions at [[choice points]] based on scanning back in the call/lookahead stack. We are not aware of any other parser generator tool that has this feature.
  
 The easiest way to describe this is with some actual examples. The easiest way to describe this is with some actual examples.
Line 89: Line 89:
 NB. If you have a ''SCAN'' statement that does not specify either numerical or syntactic lookahead, then the generated code will scan ahead an //unlimited// number of tokens. (Unless the expansion to be parsed is constrained by an [[up to here]] marker.) This is a key characteristic of the newer [[scan statement]]. NB. If you have a ''SCAN'' statement that does not specify either numerical or syntactic lookahead, then the generated code will scan ahead an //unlimited// number of tokens. (Unless the expansion to be parsed is constrained by an [[up to here]] marker.) This is a key characteristic of the newer [[scan statement]].
  
-Note also that //contextual predicates//, like syntactic lookahead in JavaCC 21, can be nested arbitrarily and work in an arbitrarily nested scanahead routine.+Note also that //contextual predicates//, like syntactic lookahead in CongoCC, can be nested arbitrarily and work in an arbitrarily nested scanahead routine.