Question
Activity 1 regular expression is found to be 0+1(0+1)*
Write a context-free grammar for arithmetic expressions consisting of non¬negative binary integer numbers defined in Activity 1 and four operators, + (addition), - (subtraction), * (multiplication), and / (division). No precedence or associativity need to be considered in the grammar. In addition, no parentheses can be used in expressions. For example, (10 + 1) * 101 is not acceptable. The regular grammar you have obtained in Activity 1 should be included as part of your solution.
Explanation / Answer
0+1(0+1)*
S---->S+S | S * S | S - S | S / S | P (S,symbol)
P----->0 | 1Q
Q----->0Q |1Q | e ,answer