You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Knowing that I can handle left recursion cases by rewriting the grammar. But I am wondering if there is any other approach (since rewriting might greatly reduce the code readability beacause we can not easily infer the usage of a single combinator literraly) in some simple cases like recursively parsing an arithmetic grammar(I believe threre is no a general method to handle left recursion without rewriting grammar at current version).
Here is an example:
We have a left recuesive grammar :
E -> E op E (op = {'+','-','*','/','&','|',"==","!="})
E -> T (BuiltInType)
E -> F (Function Call)
E -> (E)
We rewrite it into:
E -> (E)E'
E -> TE'
E -> FE'
E'-> op E E' | ε
Before we rewrite it,each production can be clearly and easily described by a single combinator.But after rewriting the grammar, each production is coupling with E' which greatly reduces the self-explanation of combinators
Knowing that I can handle left recursion cases by rewriting the grammar. But I am wondering if there is any other approach (since rewriting might greatly reduce the code readability beacause we can not easily infer the usage of a single combinator literraly) in some simple cases like recursively parsing an arithmetic grammar(I believe threre is no a general method to handle left recursion without rewriting grammar at current version).
Here is an example:
We have a left recuesive grammar :
We rewrite it into:
Before we rewrite it,each production can be clearly and easily described by a single combinator.But after rewriting the grammar, each production is coupling with E' which greatly reduces the self-explanation of combinators
#445 is a previous issue
The text was updated successfully, but these errors were encountered: