I have next rules:
factor ::= id | func | ( expr )
func ::= id ( list )
list ::= list , expr | expr
I write simple descent parser:
function factor() {
if (lookahead === "(") {
match("(");
expr();
return match(")");
} else {
id();
} // How to understand what it can be a func here?
};
function func() {
id();
match("(");
list();
match(")");
};
But how to combine func and id?