Help with porting grammar from PEGjs to D for dustjs project!
Uranuz via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Aug 3 08:30:25 PDT 2014
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 though that it is productive way to make
porting manually. It's long and something could change in the
source JavaScript code. And it will be not so easy to maintain.
So I remembered about PEGGED project for D. As I see formats for
writing grammar differs for these two systems and I have no
experience with using grammar generators.
So I need some help with rewriting grammar from PEGjs into PEGGED.
Also I don't understand in PEGGED (I have not tried to use it
yet) how to generate some logic from AST. Where should I describe
it or should I walk around all nodes for somehow and generate
code for them.
Goal of this is to use dust template system as template engine at
server side. I also considered handlebars.js, but I can't
evaluate what is more suitable for my purposes. The choice is
just very subjective.
More information about the Digitalmars-d-learn
mailing list