1) I need the best and beautifull solution to select node for adding current stament. I read code by rows.
If I get "IF" in my parser, root should be IfStatement and next statements should be added to it.
If I get "END IF", I need make step up to above node. May be it should be something like switcher..
2) LetStatement has no descendants .Whether it should inherit class BaseStatement??
Thank you very much for your advice. But I don`t ask about code parsing. I have already made this task. I have statements (code blocks) with correct expression tree.
I ask about adding Statement object in code tree, in correct node. And how switch to other node when "if" or "while" statements are finished (end if, end while)..?