How to remove the ambiguous and infinite left recursion?

SyntaxEditor for WPF Forum

Posted 8 years ago by Peter Luo - AIMNEXT
Version: 12.1.0560
Avatar

Hi,

I'm writting a C99 grammar according to a EBNF which I got it from the network.

 After I completed it and load it, there are a lot of ambiguous and infinite left recursion errors.

I have modified some, but I have no idea to others.

Can you give the general train of thought to resolve these problems? Like define more non-terminals or...

Thanks a lot!

Comments (1)

Answer - Posted 8 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Peter,

For ambiguities, you can do look-aheads with our grammar framework via the use of CanMatch callbacks.  Our LL(*) Parser Framework documentation has coverage of that, and even shows an example or two of removing left recursion.

You also might find a lot of articles on the web about removing left recursion in EBNF since that's a common question.  I believe this Wikipedia article includes some info but any good book on parsing techniques should also have more extensive info.


Actipro Software Support

The latest build of this product (v2019.1 build 0683) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.