Abstract syntax tree using a shunt algorithm

I have an expression for infix, which I have tokenized, and I would like to move on to creating an abstract syntax tree. I understand the shunting algorithm that is used in these cases. I just found ways to convert the infix expression to RPN format, not AST. I could create an RPN version first and then an AST, but that seems unnecessary.

My language of choice is JavaScript, although I only need to see an example in any language and / or description of the algorithm. I looked through the Dragon book and the book of Terence Parr, but did not give the answer I was looking for.

+4
source share

Source: https://habr.com/ru/post/1523734/


All Articles