4 ms·
Interesting approach. Instead of using a program to generate the table that is used by the parsing algorithm (like yacc) it generates it during compile time. Th
by fjfaase 5y ago
Interesting approach. Instead of using a program to generate the table that is used by the parsing algorithm (like yacc) it generates it during compile time. This should not be any slower (in order of magnitudes) than using a parser generator.
Also nice how you can integrate the semantics within the rule by the use of lambda expressions.
(I have experience with writing parser and developed an interpreting parser myself. https://github.com/FransFaase https://github.com/FransFaase )
- peter-winter 5y agoWell, the json parser example is th heaviest one, compiling about a minute on my 2 core virtual machine. I guess it doesn' really matter, you can always put the parser definition is a separate compilation unit. The language grammar you are parsing should not change too frequently.
- fjfaase 5y agoThat is really much longer than would expect. Sounds like using the C++ compiler for this purpose is not working well.
- peter-winter 5y agoNot at all. I didn't try too hard to optimze it yet, and when I use a modern physical machine, it will probably be more like 20 seconds already. I bet I could make it twice as fast after optimization.
- peter-winter 5y agoI just relased a new version. GCC compiles a JSON parser example in less than 8 seconds. Still on a low resource VM.