Hi,
I've just published a small tool that helped me prototyping grammars.
PP2PEGGrammar - the original PEG ASCII syntax
PP2PEGParserParser - parse a PEG and build a parser object
PP2PEGParserCompiler - compile a PEG to methods and variables in a given
parser class
It is available as PetitParser2-PEG in the PublicStore (VW) and on GitHub
(https://github.com/merkste/petitparser2/tree/PEG).
Best, Steffen
Am .10.2018, 22:46 Uhr, schrieb Steffen Märcker <merk...@web.de>:
I gave Xtreams-Parsing and PetitParser a shot and like to share my
findings.[*]
The task was to parse the modelling language of the probabilistic model
checker PRISM. I've written a grammer of about 130 definitions in the
Xtreams DSL, which is close to Bryan Fords syntax. To avoid doing it all
again with PetitParser, I wrote a PetitParserGenerator that takes the
DSL and builds a PetitParser.
The numbers below are just parsing times, no further actions involved.
For reference I show the times from PRISM (which uses JavaCC), too --
although they involve additional verification and normalization steps on
the AST.
input Prism XP PP
230kB 14s 9s 2s
544kB 121s 20s 5s
1.1MB 421s 34s 8s
1.4MB 1091s 47s 12s
2.2MB 63s 16s
2.9MB 81s 20s
3.8MB 107s 25s
4.4MB 123s 30s
Please note that these times are not representative at all. It's just a
single example and I put zero effort in optimization. However, I am
quite satisfied with the results.
[*] I was already familiar with the DSL of Xtreams-Parsing, which I like
very much. I did not consider SmaCC, as I find PEGs easier to use.
Best, Steffen
Am .10.2018, 20:14 Uhr, schrieb Steffen Märcker <merk...@web.de>:
Dear all,
I have two questions regarding parsing frameworks.
1) Do you have any insights on the performance of SmaCC VS Xtreams
Parsing VS PetitParser?
2) Has anybody started to port PetitParser 2 from Pharo to VW? Is it
worth the effort?
Sorry for cross-posting, I thought this might interest both communities.
Cheers, Steffen