I want to write a recursive descent parser for the following grammar
term ---> FINAL | FUNCTION_A (term, term) | FUNCTION_B (term, term)
Currently I am struggeling with the FUNCTION part, since I don't know, how to handle cases, where a command contains nested FUNCTIONS, e.g.
FUNCTION_A (FUNCTION_B (FINAL, FINAL), FINAL)
I've read quite a lot of tutorials but none of which really helped me to get through this. As far as I know, one can use StringTokenizer to approach this problem.
How can I use Tokens to identify the first term and the second term of FUNCTION_A for above example?