The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.
parse the ')' to a rparen and build a 'rparen' leaf
parse the 'true' and place it in the tree
parse the '(' to a lparen and insert it
... 'while' ...
So my approach would be to start with a blank statement at the beginning
add the rparen to it, so the tree is: Statement -> RParen
add the 'true' to it, so the tree is now: Statement -> True -> RParen
add the lparen to it, so: Statement -> LParen -> True -> RParen
the LParen can trigger a reduction at this step if you want
add the 'while': Statement -> While -> LParen -> True -> RParen
and reduce everything there if you want.
It would be a pretty straight tree in this case, but so be it. Maybe my understanding about top-down and bottom-up is incorrect.
Yeah, but seriously: Who reads the Insider News???
Anything that is unrelated to elephants is irrelephant Anonymous - The problem with quotes on the internet is that you can never tell if they're genuine Winston Churchill, 1944 - Never argue with a fool. Onlookers may not be able to tell the difference. Mark Twain
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.