Convert the context-free C-- grammar into an LL(1) grammar that will be suitable for use in a recursive descent parser. To do this you will need to:
Run update75 to get the file cs75/projects/2a/LL1grammar. Put your converted grammar into this file.
a[i]; // a[i] is not an lvalue here
a[i] = x; // a[i] is an lvalue here
x = 8 + (y = 6); // y is an lvalue and (y=6) returns the value 6
a[i] + b[i] = x; // a[i]+b[i] is not a valid lvalue
x = 8 + y = 6; // 8+y is not a valid lvalue, but + has higher precedence than =
a[i] + b[i] = 8;Later you can ensure that any expression appearing on the left side of an assignment expression is a valid lvalue.
int x; char y; int double(int value) { return value*2; } int main() { int z; read x; z = double(x); write z; }Be sure that you have not altered the productions in such a way as to change the language that is recognized.