On Fri, 2005-01-07 at 11:10, Leopold Toetsch wrote: > - How fast is DParser compared to bison/flex? > - What about memory usage compared to bison/flex?
I will leave those questions for John, but a first guess would be that they are a bit too general to be meaningful. One would expect DParser to be slower of course; the focus is on flexibility rather than speed... > - How fast is adding rules at runtime? I can answer that. It's slow. Really slow. This is because the current implementation needs to rebuild the entire grammar and rescan all input each time a new rule is added in the middle of a parse. However, there's no reason why this can't be optimized away in the future. It's just that DParser isn't really designed for dynamic runtime grammars, and I didn't want to make any radical changes at this stage :-) > - How long does it take to create e.g. the Python grammar at runtime? The short answer is that you wouldn't do that. You just load a prepared grammar using syntax_load_data() instead. The long answer is that I just converted the grammar in the python directory of Parrot to a suitable syntax test file. The result was 339 calls to syntax_add_rule() plus one call to syntax_save_data() in 1.052 seconds on my Athlon 2400+ computer. Loading the saved grammar again took 0.012 seconds. Unfortunately, it's the former time that counts if the grammar is to be extended at runtime, so obviously something has to be done. My intention is that this shall be fast enough for languages where functions can be hooked into the grammar, so you can define "add <object> to <container>" instead of "container.add(object)" or "container_add(container, object)" like in most common computer languages. > - The Makefile of 'syntax' is too 'pedantic' gcc 2.95.3 doesn't grok it. > (getting rid of '-ansi -pedantic' does it) Can you provide some more information about this? I've built gcc 2.95.3 here (FreeBSD 5.3 port) and it seems to work fine. The entire point of using pedantic in the first place is that any ANSI C90 compliant compiler should handle the code, including gcc 2.95.3 :-) /Henrik