John Lam 1997 — 2026

Terence Parr rocks

While writing the weave expression parser for CLAW, I ran into some problems with resolving potential ambiguities in my ANTLR grammar. I posted an email to the ANTLR-Interest mailing list, and Monty Zukowski pointed me to Terence Parr’s most excellent online book: Practical Computer Language Recognition and Translation. The chapter on building recognizers by hand is particularly illuminating. Make sure to read the section where he uses a maze metaphor to explain look-ahead and back-tracking.

Currently, it looks like I can use the token stream filtering feature of ANTLR to morph my “*” tokens into unambiguous tokens that can be handled by my parser. My token stream can maintain context, and use that to disambiguate the different meanings of “*” in my weave expressions.

Have I mentioned that ANTLR rocks? ;)