Question 2: The following context-free grammar describes part of the syntax of a simple programming language. Non-terminals are given in capitals and terminals in lower case. VAR represents a variable...



Question 2: The following context-free grammar describes part of the syntax of a simple programming language. Non-terminals are given in capitals and terminals in lower case.


VAR represents a variable name and CONST represents a constant. The productions for


ASSN-STMT are not given, as they do not affect the question.




1          PROGRAM     →     Procedure STMT-LIST




2          STMT-LIST     →    STMT STMT-LIST




3                                  | STMT




4          STMT → do VAR = CONST to CONST { STMT-LIST }




5                                 | ASSN-STMT



Q) Create attribute(s) and add semantic functions to the above grammar. Write them beside the productions above.



Jun 09, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here