Help with porting grammar from PEGjs to D for dustjs project!

2014-08-03 Thread Uranuz via Digitalmars-d-learn
I want to try to implement web template engine dustjs: http://akdubya.github.io/dustjs/ At the first step implementing parser for it's grammar is needed. As far as code for parsing grammar was generated via PEGjs grammar generator the resulting code is enough long (about 4200 lines of code). I

Re: Help with porting grammar from PEGjs to D for dustjs project!

2014-08-03 Thread Philippe Sigaud via Digitalmars-d-learn
Uranuz: > http://akdubya.github.io/dustjs/ > So I need some help with rewriting grammar from PEGjs into PEGGED. Is this the grammar? https://github.com/akdubya/dustjs/blob/master/src/dust.pegjs If so, then I think I can provide some help. But I don't get what output you want (see below). > Als

Re: Help with porting grammar from PEGjs to D for dustjs project!

2014-08-03 Thread Uranuz via Digitalmars-d-learn
I am real noob about grammar description languages so I need some explanation about it. As far as I understand expressions in curly bracers are used to modify syntax tree just in process of parsing instead of modifying it after? How I could use PEGGED to map some code to these parsed expressi

Re: Help with porting grammar from PEGjs to D for dustjs project!

2014-08-03 Thread Philippe Sigaud via Digitalmars-d-learn
On Mon, Aug 4, 2014 at 7:13 AM, Uranuz via Digitalmars-d-learn wrote: > I am real noob about grammar description languages so I need some > explanation about it. As far as I understand expressions in curly bracers > are used to modify syntax tree just in process of parsing instead of > modifying i

Re: Help with porting grammar from PEGjs to D for dustjs project!

2014-08-05 Thread Uranuz via Digitalmars-d-learn
Different formats and also different languages. I don't see how you can compare a parse tree that's a D object and another tree made by dustjs: you never see the AST produced by dust, you only see the resulting JS code. Yes. That's a point. Thanks for all the explanations. I'll try to make so

Re: Help with porting grammar from PEGjs to D for dustjs project!

2014-08-05 Thread Uranuz via Digitalmars-d-learn
On Tuesday, 5 August 2014 at 08:13:25 UTC, Uranuz wrote: Different formats and also different languages. I don't see how you can compare a parse tree that's a D object and another tree made by dustjs: you never see the AST produced by dust, you only see the resulting JS code. Yes. That's a p

Re: Help with porting grammar from PEGjs to D for dustjs project!

2014-08-05 Thread Philippe Sigaud via Digitalmars-d-learn
> Is there multiline comments available inside PEGGED template? > As far as I understand inline comments are set via # sign. No, no multiline comment. That's based on the original PEG grammar, which allows only #-comments.

Re: Help with porting grammar from PEGjs to D for dustjs project!

2014-08-06 Thread Uranuz via Digitalmars-d-learn
What I was thinking about is possibility to change ParseTree struct with user-defined version of it. And I was thinking about setting tree type as template parameter to grammar: grammar!(MyParseTree)(" Arithmetic: ... "); Or somethink like this. I think changing source code of library in o

Re: Help with porting grammar from PEGjs to D for dustjs project!

2014-08-06 Thread Philippe Sigaud via Digitalmars-d-learn
On Wed, Aug 6, 2014 at 9:09 AM, Uranuz via Digitalmars-d-learn wrote: > What I was thinking about is possibility to change ParseTree struct with > user-defined version of it. And I was thinking about setting tree type as > template parameter to grammar: > > grammar!(MyParseTree)(" > Arithmetic: >