-
Notifications
You must be signed in to change notification settings - Fork 2
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
Using 'cont' for preprocess files generate code bloat ? #2
Comments
I noticed that you are using a non conventional syntax to describe regular expressions, there is any particular reason for it ? |
Here is the
The conversion script (using https://github.com/mingodad/squilu):
|
Notice that how https://www.bottlecaps.de/rr/ui do some nice simplifications/opitmizations :
|
Also there is no complete example using the generated parser (C++,JS, RUST, PHP, AWK) other than dump the reduce action.
|
Thank you for your interest. Preprocessor Preprocessor Functions to be generated as inline for each container (abstract data type eg. list, tree, ...) type was determined by me. So it is just pure experience based estimation. Surely compiler does its work, but at least he has this inline function available in headers and can opt to not inline them (as you said). What compiler cannot do is to inline functions with implementations in other compilation units. It looks that you already solved output of grammar to EBNF format. |
There is no good reason to it. Codebase is almost 12 years old, and back than I have no good insight in standard regex syntax. This syntax emerged from knowledge obtained at CS regular languages class. So I admit, syntax of regex is not standard, but on other side, it is working for me. |
After generating source code of parser, work of Semantic rules written in Generated code consists of two basic components:
Names of generated function are not important, because in target project it will be changed, or actually be methods of some class. Generated code do not impose any restrictions on target project structure. Identifiers used in generated code are prefixed by Function
These macros can be adjusted to process various types of input streams. Function For example in
|
Nice and simple conversion script, and visualization looks also great. Some of grammar rules may seem complex, but mostly it is because of need to generate reduction callbacks in interpreter or solving SLR(1) grammar restrictions. |
It's interesting your idea of using the preprocessor cont but looking at the generated files they have a full copy of almost everything and using inline for not so small functions (although the compiler can decide not to inline) doesn't it generate more code than needed ?
I like the idea of a parser and grammar interpreter to rapid prototype and also the possibility of using Lua for the actions while prototyping. I'm collecting grammars here https://github.com/mingodad/plgh and I found this tool https://www.bottlecaps.de/rr/ui fantastic to help visualize the grammar, there is any plan to add an option to output the grammar in EBNF format compatible to visualize the grammar ?
Thanks for your great work ?
The text was updated successfully, but these errors were encountered: