Answered! Add the production rules necessary to extend this grammar to include the definition of a procedure. For example…

Programming languages:

Add the production rules necessary to extend this grammar to include the definition of a procedure. For example, procedure bar (x, y) xt y foo(z Note a procedure cannot be defined within a procedure. Consider the grammar: program statements program subroutine statement assign statement e assign id F expression proc e id (parameters expression car cdr car operation expression car car- 1d car sub call car (expression) I/ operation parameters expression arg car arg car parameters arg car id any alphanumeric token, e.g., foo123) (Epsilon, E, denotes an empty string)

Add the production rules necessary to extend this grammar to include the definition of a procedure. For example, procedure bar (x, y) { z = x + y foo (z) } Note a procedure cannot be defined within a procedure. Consider the grammar: program rightarrow statements program rightarrow subroutine statement rightarrow assign statement rightarrow proc_e assign rightarrow id = expression proc_e rightarrow id (parameters) expression rightarrow car cdr cdr rightarrow operation expression cdr rightarrow epsilon car rightarrow id car rightarrow sub call car rightarrow (expression) operation rightarrow + |-| *|/parameters rightarrow expression arg_cdr arg_cdr rightarrow, parameters arg_cdr rightarrow epsilon id rightarrow (;;:any alphanumeric token, e.g., foo123) (Epsilon, epsilon, denotes an empty string)

Expert Answer

 
Still stressed from student homework?
Get quality assistance from academic writers!