-->

Abstract syntax tree using the shunting yard algor

2019-06-26 07:50发布

问题:

I have an infix expression that I have tokenised and would like to proceed to create an abstract syntax tree. I understand the shunting-yard algorithm used in these cases. I have only found ways to convert the infix expression to RPN format, not into an AST. I could create the RPN version first and then AST from it, but it seems unnecessary.

My language of choice is JavaScript, though I only need to see an example in any language and/or a description of the algorithm. I have skimmed through the Dragon Book and Terence Parr's book, but neither gave the answer I was looking for.