<div dir="ltr"><br><div class="gmail_extra"><div class="gmail_quote">On Sun, Nov 3, 2013 at 2:45 AM, Timothee Cour <span dir="ltr"><<a href="mailto:thelastmammoth@gmail.com" target="_blank">thelastmammoth@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">1)<div>The main issue I see with pegged is PEG grammars don't support left recursion, so for example will fail on foo[1].bar(2).fun().</div>
<div>Unless there's a plan to accomodate those, I sense a dead end.<br>
</div><div>One can eliminate left recursion but this has issues.</div></div></blockquote><div><br></div><div>Indeed. Eliminating left-recursion can be done, but it might disrupt the parse tree.<br></div><div>There is no discarding the fact that PEG are intrinsically made to go with top-down recursive parsers.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><br></div><div>2)</div><div>There is some material on extending PEG to support those, eg "Left Recursion in Parsing Expression Grammars", or code <a href="https://github.com/orlandohill/peg-left-recursion" target="_blank">https://github.com/orlandohill/peg-left-recursion</a> but I don't know how well they work in practice.</div>
</div></blockquote><div><br></div><div>I'll have a look, thanks. The idea seems similar to what I wanted to do, with a growing seed.</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div><br></div><div>3) </div><div class="gmail_extra">Finally, a parser should be as fast as possible; I'm not sure how well pegged performs compared to dmd frontend. </div></div></blockquote><div><br></div><div><br>
</div><div>Oh, for D it works (it's even the biggest grammar I know), but it's too slow to be of practical interest. But that just means the generated parser is not top-notch, which is reasonable: I'm not a parsing pro, just a guy doing this during his free time :)</div>
<div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra">Other promising options are using lemon, a LALR(1) parser generator.</div>
</div></blockquote><div><br></div><div>My current plan is to write different engines, and letting either the user select them at compile-time, or to have the parser decide which one to use, depending on the grammar. I'm pretty sure the 'Type 3' parts of a grammar (regular expressions) could be bone by using std.regex, for example.</div>
<div><br></div><div>I guess I'll have to write a CT-compatible LALR(1) engine...</div><div> </div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div class="gmail_extra"><div><div class="h5"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Growler:<br>
I'm using it for parsing C and Markup in two different projects.<br>
I've also just started working on an Octave (well ok, Matlab) M-file<br>
parser. It will probably never see the light of day but with<br>
Pegged is great fun to play with.<br>
<br>
Please don't lose interest in it !!<br></blockquote></div></div></blockquote></div></div></div></div></div></blockquote><div><br></div><div>OK guys, I'm hearing you. Thanks for the nice words growler! I tried to have Pegged simple to use, compared to other generator I know and I'm pleased to see it seems to work. If you have new grammars, you can send them to me, I'll put them in the examples.</div>
<div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div><div class="h5"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
</blockquote>
<br></div></div>
Yes. Probably the most significant D project at this time.<span><font color="#888888"><br>
<br>
Andrei<br>
</font></span></blockquote></div><br></div></div></div></div></blockquote><div><br></div><div>That's nothing compared to vide.d! But I guess it indeed demonstrates what can be done with the generative capabilities of D.</div>
<div>Thanks for the kind words.</div><div> </div></div><br></div></div>