Question: Programming Languages: Add the production rules necessary to extend this grammar to include the definition of a procedure. For example, procedure bar (x, y) {z

Programming Languages:

Programming Languages: Add the production rules necessary to extend this grammar to

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 rightarrow car rightarrow sub_call car rightarrow (expression) operation rightarrow + |-| *|/parameters times expression arg_cdr arg_cdr parameters arg_cdr rightarrow epsilon id rightarrow. . .(;;:any alphanumeric token, e.g., foo123) (Epsilon, E, denotes an empty string)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!