# Gold Challenge - Recursive Solution Explanation

I had researched recursive descent parsers, but seemed overly complex for the challenge set to us. So I thought to use this forum as I wasn’t making any headway. I have seen a solution on the 1st Edition forum for this chapter, using a recursive method (as opposed to splitting into new arrays, appending, removing, etc).
https://forums.bignerdranch.com/t/silver-gold-challenge/8515?

It works great, is succinct without having to add significant amounts of code. But I’m struggling to see how its actually working. My interpretation is:

1. Adjust the Token enum to include the extra parameters - no problems, was the 1st thing I added myself anyway
2. Adding extra case statements to the lex() function to add as tokens - again, extension of the above, already did this
3. Changed the parse() function so that it now has a changed flow

my best explanation for this “flow”:

1. Multiply & divide cases are first - presuming because the order the maths needs to occur in
2. They call the getNumber() function as normal (value has a value, this loop through the token has a mulitply value, and the nextNumber gets the next number and multiplies them together.
3. Switch statement continues to the Plus / Minus cases, where it does a recursive call to the parse() function. i think this is to skip onto the next token value? But why wouldn’t we use advance()?

Can someone explain the workings please? My brain works easiest with graphically explaining, if its possible to do…