Start with your p4 assignment The rules listed below are all the rules for which you will have to create actions in order to implement expressions. You will also have to add an action for optional_initializer and you will have to update your variable_declaration action to use the optional_expression instead of the defaults (42, 3.145, "hello"). //--------------------------------------------------------------------- the first rule (primary_expression) just returns ($$ = ) the expression generated by the primary_expression rule each of the others instantiates a new Expression object expression: primary_expression | expression T_OR expression | expression T_AND expression | expression T_LESS_EQUAL expression | expression T_GREATER_EQUAL expression | expression T_LESS expression | expression T_GREATER expression | expression T_EQUAL expression | expression T_NOT_EQUAL expression | expression T_PLUS expression | expression T_MINUS expression | expression T_ASTERISK expression | expression T_DIVIDE expression | expression T_MOD expression | T_MINUS expression | T_NOT expression | math_operator T_LPAREN expression T_RPAREN // DO NOT IMPLEMENT THIS RULE FOR P5 | variable geometric_operator variable //--------------------------------------------------------------------- the first just returns ($$ =) the expression in $2 the rest instantiate a new Expression object primary_expression: T_LPAREN expression T_RPAREN | variable | T_INT_CONSTANT | T_TRUE | T_FALSE | T_DOUBLE_CONSTANT | T_STRING_CONSTANT //--------------------------------------------------------------------- each of these instantiates a single new Variable object ONLY IMPLEMENT THE FIRST 2 FOR P5 variable: T_ID | T_ID T_LBRACKET expression T_RBRACKET // DO NOT IMPLEMENT THESE TWO FOR P5 | T_ID T_PERIOD T_ID | T_ID T_LBRACKET expression T_RBRACKET T_PERIOD T_ID The following sets of productions are really simple, each just returns ($$ = ) a constant that represents the operator You can use the enumerated type Operator_type from gpl_type.h or you can use the actual token (tokens are elements of an enumerated type, see y.tab.h) $$ = INT; // this is using the Operator_type $$ = T_INT; // this is using the enumerated type from y.tab.h //--------------------------------------------------------------------- // you can skip this until later but since it looks just like the // math_operator you might as well do it now geometric_operator: T_TOUCHES | T_NEAR //--------------------------------------------------------------------- math_operator: T_SIN | T_COS | T_TAN | T_ASIN | T_ACOS | T_ATAN | T_SQRT | T_ABS | T_FLOOR | T_RANDOM