Tips and Tricks

“You can’t get there from here!” — The Problem of Context-Sensitive Tokenization

(N.B. Note added 13 June 2021: This article is useful in terms of understanding how to add token hooks to code. However, in terms of solving the specific problem outlined, the article is obsolete. See here for the updated solution.) Since I picked up my work on the JavaCC codebase at the end of 2019, …

“You can’t get there from here!” — The Problem of Context-Sensitive Tokenization Read More »

Straightforward LOOKAHEAD Enhancements

A couple of weeks ago, I implemented a solution to a longstanding Dmitry Dmitriyevich problem with LOOKAHEAD specifications in JavaCC. Dmitry Dmitriyevich (alternatively Ivan Ivanovich or Vladimir Vladimirovich) is my own personal terminology for situations where you are required to write highly repetitive code. (Patriotic Irishmen are welcome to call this the Patrick Fitzpatrick or Gerald …

Straightforward LOOKAHEAD Enhancements Read More »

Revisiting LOOKAHEAD in JavaCC, Attacking the Dmitry Dmitriyevich Problem

As a result of some private correspondence with one of the PMD developers (PMD makes extensive use of JavaCC) I started thinking about some issues that I had in the back of my mind to look into at a later point. Having recently ripped out the code in JavaCC 21 that supported putting LOOKAHEAD specifications …

Revisiting LOOKAHEAD in JavaCC, Attacking the Dmitry Dmitriyevich Problem Read More »