hanickadot / compile-time-regular-expressions

Compile Time Regular Expression in C++
https://twitter.com/hankadusikova
Apache License 2.0
3.39k stars 187 forks source link

Questions about the online desatomat tool, CTRE, and pcre.hpp #320

Open alexios-angel opened 3 months ago

alexios-angel commented 3 months ago

I am trying to recreate your desatomat tool in python so I can make a LL(1) ANTLR & EBNF grammer parser.

The following types are missing from pcre.hpp but were present in the output of the desatomat tool:

I have some questions about the tool:

hanickadot commented 3 months ago

Were these optimized out of the pcre grammar?

yes

Why not make a rule called "ignore" and whenever it is come across it you ignore it and don't place it on the stack?

not sure if I follow you, why?

If I write my grammar in Extended Desátomatu Syntax and replace the pcre.hpp with the output from the desatomat tool would it work?

yes, if you use right generator

What is Extended Desátomatu Syntax? I have never heard of it in any literature. Is it a variant of EBNF?

it's my own, it's the syntax you can see in pcre.gram

Why not use EBNF/PEG to describe the regex grammar? Is there something special about EDS?

because long time ago I did my thing and start building it with it, and I'm not going to change that now, especially I have a lot of my own transformations which would be hard to replicate somewhere else with significant time investment

Why are comments not supported by CTRE? You can split the regex by comments, join the regex_results, and then feed the resulting string back into CTRE

Because you are in C++, you can put comment into normal code and won't pay price for its parsing.