Do you know where your variables are? | |
PerlMonks |
Perl 6 grammars - setting the actions objectby Anonymous Monk |
on Jul 17, 2016 at 22:24 UTC ( [id://1167927]=perlquestion: print w/replies, xml ) | Need Help?? |
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hello dear monks,
I am trying to work my way through Perl grammars and, more specifically, actions objects. I have written this grammar for a subset of JSON (as a shorter example of my larger problem): Used with the following JSON subset string and parsing call: I get the following stringified match object: So parsing the string with the grammar seems to work correctly. I have a problem when I try to add an actions object. This is about the best actions class I could come up with so far: With this actions class, I get the following AST: Except for the address component, the AST seems correct. The address component is not transformed into AST nodes obviously because of this line: in the value method of the actions class, which just stringifies the address sub-object. I have put that line so far as a temporary workaround just to get the overall shebang sort of working, but I have no idea how to get further. Specifically, I have tried many things, but I just can't figure out how to identify that the value is itself (recursively) an object and, even if I knew how to identify that, I still probably wouldn't know how to process it to produce a proper AST subtree for it. Would a nice monk around here be kind enough to enlighten me on this last part?
Back to
Seekers of Perl Wisdom
|
|