compile-time-regular-expressions icon indicating copy to clipboard operation
compile-time-regular-expressions copied to clipboard

Convert CTRE from PCRE Grammar to PEG for Compile-Time Lexer

Open alexios-angel opened this issue 2 years ago • 0 comments
trafficstars

Hello,

I'm impressed with your project and I'm considering repurposing some of its code to create a compile-time lexer. From my observation, to transition from the PCRE grammar to a PEG grammar, it appears that only the .gram file needs modifications.

Could you guide me on this? Here's an example I'd like to discuss:

start = expression;

expression = term ( ("+" / "-") term )*;
term       = factor ( ("*" / "/") factor )*;
factor     = NUMBER / "(" expression ")";

NUMBER     = [0-9]+ ("." [0-9]+)?;

Thank you for your time!

alexios-angel avatar Aug 21 '23 16:08 alexios-angel