jflex icon indicating copy to clipboard operation
jflex copied to clipboard

refactor front-end to produce clean AST

Open lsf37 opened this issue 8 years ago • 0 comments

For some time in the future when there is time for such things:

At some point we should refactor the front-end (mostly LexParse.cup) to produce a clean abstract syntax tree and move any imperative action code to a separate phase. Will probably also need a closer look at the scanner for the same thing.

Specs are usually small, so this should have no impact on generator performance.

The advantage would be a separation of concerns between parsing the textual spec and constructing the actual action. This would mean you could produce input for JFlex programmatically much more easily, e.g. we could build an interface that is (more) compatible with dynamic RegExp libraries, we could generate tests, etc.

This is mildly related to, but not required by issue #216, because that issue needs a similar refactor for char classes, which seem to be the most imperative part of the parser.

I should have done the parser in this style from the very start. I blame youthful enthusiasm..

lsf37 avatar Nov 22 '17 01:11 lsf37