Question: How much work is involved to covert a Peg.JS file to Pegasus?
soates opened this issue · comments
soates commented
Hi,
As the title suggests, we have peg.js file currently and are looking to move to .net..
As a rough guide - how much work would we be looking at?
Thanks,
John Gietzen commented
The biggest difference is that Pegasus is strongly typed. You can use <object>
for most of your rules, and this works well with anonymous types which map pretty closely to JavaScript Objects.
For a large grammar it could be a couple days work.
Pegasus also doesn't auto-tuple sequences. So, this kind of thing behaves differently in Pegasus and PEG.js:
rule = expr:(a b c d) { expr }
To get similar behavior in Pegasus, you would need to capture the expressions:
rule <object[]> = a:a b:b c:c d:d { new[] { a, b, c, d } }