Recursive Decent Parsing:Functions to parse the Toy Grammar III
Here is the last of the four functions of the Toy Grammar. This grammar rule had several alternatives. A switch() statement selects the right alternative to parse based on what the current look ahead token is.
Remember, no actions are yet added to these functions. All they do is recognize the input and move on; they dont do anything with it yet.
<> => ID | CONST | ( <> )
if( tokentype != RIGHTPAREN )
error(Missing ID, CONST, or ();