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 22:13:04 PDT 2014


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 
expressions to generate code that will perform operations defined 
by this grammar? Should I walk around all the syntax tree and 
just append code to some string and mix it in then or are there 
some features for code generation?

Something that I was thinking about is comparision of resulting 
syntax tree to check if it was correctly implemented. It would be 
great if different gramar parsers will output result in common 
format (JSON or XML for example) and it will be possiple to 
compare them for equality. But different parsers have different 
internal format of tree so maybe creating some transformation is 
possible. With this feature it could be possible to say if parser 
is working correctly.


More information about the Digitalmars-d-learn mailing list