Question: Semantic Analysis (30) Consider programs consisting of two parts (a) The first part has only one function declaration: functionName(parameterList) where functionName is an identifier (i.e.,
Semantic Analysis



(30) Consider programs consisting of two parts (a) The first part has only one function declaration: functionName(parameterList) where functionName is an identifier (i.e., a sequence of letters) and parameterList is of the form type id1, type id2, ..., type idn, where type is int or bool, and idi's are identifiers. An example of a function declaration is f(int x, bool y) (b) The second part has only a function call of the form functionName(argumentlist) where argumentlist is of the form idi, id2, ..., idn where idi's are identifiers. For example, f(x, z) An example program is f(int x, bool y) f(x, z) Questions. (a) Write a context free grammar (CFG) for such programs
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
