I’m trying to make a lexical parser to compute all solutions given a EBNF term. For example:
Grammar:
T::= nil | A.T | (T+T) | (T*T)
A::= a | b | c | d | e
Operators:
* Exclusive OR
. Sequence
+ Parallel
Symbols:
a b c d e
Example term:
a.(b+c).(d*e)
Computed term:
Expected tree output:
The solution should be all tree branches.
My question is that which will a optimal approach for doing this?
For now i want to user ANTRL to build the grammar parse tree.
But im not very sure on how to make the refactor approach to compute the term.
Thanks!