A function call consists of the name of a function followed by an argument list.
ID: 639935 • Letter: A
Question
A function call consists of the name of a function followed by an argument list. Assume that the arguments in a function call can either be a variable, a number, or another function call. Arguments in a function call are surrounded by parentheses and separated by commas. Give a context-free grammar that generates the language of function calls. Assume that the terminals ID and N generate identifiers (for both function names and variable names) and numbers, respectively. The empty argument list is legal. E.g., f(x, g(h(), 3), k(x, p(0))) is a function call in the language.
Explanation / Answer
A grammar is a set of rules. A context-free grammar defines rules in a particular way: as a series of productions. Our goal is to use these rules to generate sentences that have the structure of English. Here
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.