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.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here