SWE 637 In Class Exercise Number 12B
Consider the following grammar
with "expr" as the start symbol.
expr ::= number | expr pair
number ::= digit digit // exactly 2 digits
pair ::= number op | number pair op
op ::= "+" | "-" | "*" | "/"
Also consider the following mutation, which adds an additional rule to the grammar:
pair ::= number op | number pair op | op number
- Mark each of the following strings as either IN or OUT
of the (unmutated) grammar:
___ 1
___ 12
___ 12 + 34
___ 12 34 +
___ 12 34 56 - *
___ 12 34 - 56 *
___ 12 34 - 56 * +
- Find a string (from the list above) that is generated by the mutated
grammar, but not by the original grammar.
-
Find a string (from the list above) that can be generated with the new rule in the
mutant grammar, but is also in the original grammar.
Demonstrate your answer by giving the two relevant derivations.