grmtools
grmtools copied to clipboard
Support lex-style definitions
I didn't see a way to do the following that can be done in lex:
DIGIT [0-9]
ID [a-z][a-z0-9]*
NUMBER {DIGIT}+"."{DIGIT}*
%%
{NUMBER} ...
so that patterns can be composed in definitions and definitions can be used in rules.
Yes, this isn't currently supported. Given that we currently use the Rust regex crate, if we wanted to do something like this, we'd have some interesting fun and games getting escaping right. So a basic version is pretty easy; a version with good error messages might be challenging.