Can I push back the most recently read token into the input stream?

Terence Parr

You are thinking in terms of the old one-token-of-lookahead type parser generators without backtracking capabilities. ANTLR specifically provides a mechanism to lookahead ahead a fixed amount, k, or infinitely via syntactic predicates (a selective programmer-controlled form of backtracking). You can tell ANTLR to try out an alternative and back up to retry the next potentially viable alternative if that one fails. It's like specifying the infinite lookahead language that predicts an alternative.

0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact