Closed flip111 closed 5 years ago
Does that class help you ? https://github.com/guiled/Hoathis-Lua/blob/v2/src/Debugger.php
Maybe. I'm not sure how it would help. Some methods return a string which can't be traversed obviously. Did you have something in mind on how i should use this class?
The only way it would help is that it can inspire you ;-) The point of this class is to print the pp grammar from the grammar tree.
The only way is to use getRules
(https://github.com/hoaproject/Compiler/blob/master/Llk/Parser.php#L764) to get all the rules, and then use a foreach
loop, it's a linear structure.
This answer is the right answer (closing ticket). We could put some code or documentation for this. What do you think?
After the PP is read how can the grammar nodes be access / traversed programmatically? Before reading in any actual input for the parser.