Reducing Pegged ASTs
"Nordlöw" via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Nov 25 07:12:37 PST 2014
Is there a way to (on the fly) reduce Pegged parse results such as
C [0, 6]["int", "x", ";"]
+-C.TranslationUnit [0, 6]["int", "x", ";"]
+-C.ExternalDeclaration [0, 6]["int", "x", ";"]
+-C.Declaration [0, 6]["int", "x", ";"]
+-C.DeclarationSpecifiers [0, 4]["int"]
| +-C.TypeSpecifier [0, 4]["int"]
+-C.InitDeclaratorList [4, 5]["x"]
+-C.InitDeclarator [4, 5]["x"]
+-C.Declarator [4, 5]["x"]
+-C.DirectDeclarator [4, 5]["x"]
+-C.Identifier [4, 5]["x"]
to
C [0, 6]["int", "x", ";"]
+-C.TranslationUnit [0, 6]["int", "x", ";"]
+-C.ExternalDeclaration [0, 6]["int", "x", ";"]
+-C.Declaration [0, 6]["int", "x", ";"]
+-C.TypeSpecifier [0, 4]["int"]
+-C.Identifier [4, 5]["x"]
and still, when needed, be able query that C.Identifier is an
instance of C.DirectDeclarator etc?
If not this seems like a cool feature to have ;)
I guess it would reduce memory requirements by about a magnitude
right?
More information about the Digitalmars-d-learn
mailing list