Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
alexios-angel opened this issue Aug 21, 2023 · 0 comments
Open

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

alexios-angel opened this issue Aug 21, 2023 · 0 comments

Comments

@alexios-angel
Copy link

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant