Exercise ‹43›:

CFG for expressions over {+,−,∗,/,(,),0,1,…,9}\{ + , - , * , / , ( , ) , 0 , 1, \ldots, 9 \}
Write a CFG generating the language of “well-formed” expressions over {+,−,∗,/,(,),0,1,…,9}\{ + , - , * , / , ( , ) , 0 , 1, \ldots , 9 \}. For instance, 23∗(2+003)+15∗423*(2+003)+15*4 is a well-formed expression, whereas 13∗∗1513**15 and )(3)(3 are not. For simplicity, in this problem we exclude the use of ++ and −- as unary operators, such that we also consider +3+3 or −5-5 as non-well-formed expressions.
Authors: Carles Creus, Guillem Godoy / Documentation:
To be able to submit you need to log in, register, or become a guest.