moving from classical lex/yacc to pegged parser

Dukc ajieskola at gmail.com
Fri May 10 10:25:18 UTC 2024


Dmitry Ponyatov kirjoitti 9.5.2024 klo 11.30:
 > And I also can't figure out how to inherit `ParseTree` with all my 
script language objects to get AST right from pegged parser. Should I 
use some superloop with lot of matches to process parsed `pt` tree into 
something I need myself, to drop all unneeded parsing meta info and get 
clean semantic AST?

Pegged can help you with that filtering part, at least to some extent. 
Remember you can use : and ; prefix operators in the grammar spec, and 
Pegged will drop the needless nodes for you.

Or do the reverse, use ^ prefix operator (or write a new rule) to make a 
node out of Pegged builtins.


More information about the Digitalmars-d-learn mailing list