Hello all. I have a lexer built that streams out tokens from in input but I'm not sure how to build the next step in the process - the parse tree. Does anybody have any good resources or examples on how to accomplish this?
...
Is it possible to generate a parse tree at the same time as I use recursive descent parser to check if the data matches grammar?
If so, what approach would I use to build a tree as I recursively descent?
Thanks, Boda Cydo.
Note: I am new to parsing. (Asked several questions on SO already, and I am getting better with it.)
...
I am trying to generate a syntax tree, for a given string with simple math operators (+, -, *, /, and parenthesis).
Given the string "1 + 2 * 3":
It should return an array like this:
["+",
[1,
["*",
[2,3]
]
]
]
I made a function to transform "1 + 2 * 3" in [1,"+",2,"*",3].
The problem is: I have no idea to give priority t...