Lab Exercise 2 To allow for multiple expressions, you need to have some recursion. For example, this rule for "exp" allows for arbitrarily long expressions: exp : term | exp '+' term ; So a single number (e.g. 1) is picked up by term a following '+' and another number (e.g. 1 + 2) is picked up by exp '+' term another following '+' and another number (e.g. 1 + 2 + 3) is picked up by exp '+' term and so on. I am assuming that there are other rules to recognise numbers as terms etc. Similarly, one way to do this part of the lab is to change the rule for "input" from: input : exp ';' { printf("\n"); printtree ($1, 1); printf("=%d\n", evaluate ($1)); ; to: input : exp ';' { printf("\n"); printtree ($1, 1); printf("=%d\n", evaluate ($1)); | input exp ';' { printf("\n"); printtree ($2, 1); printf("=%d\n", evaluate ($2)); ; but there are several other equally good (if not better) ways. Note that this allows for 1 or more expressions, which is not exactly what is asked for. We can get 0 or more expressions by: input : | input exp ';' { printf("\n"); printtree ($2, 1); printf("=%d\n", evaluate ($2)); ;