Here is a small part of the original grammar for which I have to implement a recursive decent parser. We need to resolve the ambiguity by leaving the recursion etc out of it so that we can implement our parser. I executed the other bits, but cannot figure out how to handle the not (~) operator.
A valid expression may be. 1 and ~ 1, (1 and ~ 1) etc
I process curly braces as well as / or a character, but I cannot process the ~ character.
Here is the original grammar.
A -> A & A
A -> ~A
A -> (A)
A -> 0 | 1
I can’t figure out how to handle ~ .
Here is my solution:
one -> two one'
one' -> ~one|^
two -> three two'
two' -> & three two'|^
three -> four three'
three' -> || four three' | ^
four -> (one) |0 |1
, / . ~ . , LL (1)