otac0n / Pegasus

A PEG parser generator for .NET that integrates with MSBuild and Visual Studio.

Home Page:http://otac0n.com/Pegasus/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question: How much work is involved to covert a Peg.JS file to Pegasus?

soates opened this issue · comments

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,

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 } }