Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Left recursion still not working #60

Closed
JFinis opened this issue May 22, 2012 · 3 comments
Closed

Left recursion still not working #60

JFinis opened this issue May 22, 2012 · 3 comments

Comments

@JFinis
Copy link

JFinis commented May 22, 2012

Hi,

the latest early access (built from latest commit d378469) is still not able to handle a (non-mutually) left recursive grammar. The following simple grammar yields the error:

qualifiedName returns [Object res]  
    : name=ID 
            { return null; }

    | (scope=qualifiedName '.') name=ID 
            { return null; }
    ;

ID 
    : '0'..'9'+;

the resulting error is error(119): ... ::: The following sets of rules are mutually left-recursive [qualifiedName]

@parrt
Copy link
Member

parrt commented May 22, 2012

That doesn't fit the pattern. why do you have extra parens?

@parrt parrt closed this as completed May 22, 2012
@JFinis
Copy link
Author

JFinis commented May 22, 2012

oh, the parens are the problem? They are superfluous, agree. A relic of the non-left recursive (name .)* name form. However, should the parser rely on simple pattern matching for detecting mutual left recursion? I dont think that extra parens should ever change the semantics of a grammar file.

@parrt
Copy link
Member

parrt commented May 22, 2012

Hi. No doubt the computation is undecidable or close for arbitrary grammars. I am doing a pattern match for only those grammars that will work with the generated code pattern. It is a fairly complicated precedence parsing mechanism. I must be able to determine the operators, which would be quite difficult for arbitrary grammars.

parrt pushed a commit that referenced this issue Jun 30, 2015
Updated portable targets
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants