Question: This is Principles of Programming Languages class it has a question and I file I will post it together please help me thank you 1.
This is Principles of Programming Languages class it has a question and I file I will post it together please help me thank you

1. (1.5pt) Add the necessary rules to recognize the arithmetic operators: +,-,*,/,+=, ++,=,==, ~=, . See the file tokens.h to determine the constants to be used (they start with the prefix 'OP-?). // keywords #define K_FOREACH 200 #define K_PRINT 201 #define K_WHILE 202 #define K_REPEAT 203 #define K_UNTIL 204 #define K_BEGIN 205 #define K_END 206 #define K_DECLARE 209 #define K_IF 210 #define K_THEN 211 #define K_MAIN 212 #define K_INTEGER 213 #define K_FLOAT 214 // operators #define OP_ASSIGN 220 #define OP_ADD 221 #define OP_SUB 222 #define OP_MUL 223 #define OP_DIV 224 #define OP_LT 225 #define OP_GT 226 #define OP_LEQ 227 #define OP_GEQ 228 #define OP_EQ 229 // OP_DIFF is #define OP_DIFF 230 // OP_PLUSPLUS is ++ #define OP_PLUSPLUS 231 // OP_ADDINC is += #define OP_ADDINC 232 #define CAR_A 400 #define CAR_B 401 #define CAR_C 402 #define CAR_AB 403 // literals #define T_ID 240 #define L_INTEGER 241 #define L_FLOAT 242 #define T_EOF 280 1. (1.5pt) Add the necessary rules to recognize the arithmetic operators: +,-,*,/,+=, ++,=,==, ~=, . See the file tokens.h to determine the constants to be used (they start with the prefix 'OP-?). // keywords #define K_FOREACH 200 #define K_PRINT 201 #define K_WHILE 202 #define K_REPEAT 203 #define K_UNTIL 204 #define K_BEGIN 205 #define K_END 206 #define K_DECLARE 209 #define K_IF 210 #define K_THEN 211 #define K_MAIN 212 #define K_INTEGER 213 #define K_FLOAT 214 // operators #define OP_ASSIGN 220 #define OP_ADD 221 #define OP_SUB 222 #define OP_MUL 223 #define OP_DIV 224 #define OP_LT 225 #define OP_GT 226 #define OP_LEQ 227 #define OP_GEQ 228 #define OP_EQ 229 // OP_DIFF is #define OP_DIFF 230 // OP_PLUSPLUS is ++ #define OP_PLUSPLUS 231 // OP_ADDINC is += #define OP_ADDINC 232 #define CAR_A 400 #define CAR_B 401 #define CAR_C 402 #define CAR_AB 403 // literals #define T_ID 240 #define L_INTEGER 241 #define L_FLOAT 242 #define T_EOF 280
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
