Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » antlr issue when compiling grammar
antlr issue when compiling grammar [message #760454] Fri, 02 December 2011 12:43 Go to next message
Hannes F is currently offline Hannes FFriend
Messages: 7
Registered: November 2011
Junior Member
Hi!

I have a problem generating the artifacts for the grammar XText.xtext as attached to this post.

The following errors are printed:
warning(205): ../arden.xtext/src-gen/arden/xtext/parser/antlr/internal/InternalXText.g:2113:1: ANTLR could not analyze this decision in rule rulelogic_block; often this is because of recursive rule references visible from the left edge of alternatives.  ANTLR will re-analyze the decision with a fixed lookahead of k=1.  Consider using "options {k=1;}" for that decision and possibly adding a syntactic predicate.
error(10):  internal error: org.antlr.tool.Grammar.createLookaheadDFA(Grammar.java:1279): could not even do k=1 for decision 20; reason: timed out (>12000ms)
 

warning(200): ../arden.xtext/src-gen/arden/xtext/parser/antlr/internal/InternalXText.g:2585:1: Decision can match input such as "RULE_LET" using multiple alternatives: 1, 2, 3, 5, 6
As a result, alternative(s) 2,3,5,6 were disabled for that input
warning(200): ../arden.xtext/src-gen/arden/xtext/parser/antlr/internal/InternalXText.g:2585:1: Decision can match input such as "RULE_NOW" using multiple alternatives: 1, 3, 6
As a result, alternative(s) 3,6 were disabled for that input
warning(200): ../arden.xtext/src-gen/arden/xtext/parser/antlr/internal/InternalXText.g:2585:1: Decision can match input such as "RULE_IDENTIFIER" using multiple alternatives: 1, 3, 6
As a result, alternative(s) 3,6 were disabled for that input
error(201): ../arden.xtext/src-gen/arden/xtext/parser/antlr/internal/InternalXText.g:2585:1: The following alternatives can never be matched: 3,5,6


In line 2113 of InternalXText.g, there is the ANTLR rule code derived from the following XText.xtext rule:
logic_block :
      logic_statement=logic_statement semicolon logic_block=logic_block
    | logic_statement=logic_statement;

That rule is right-recursive which should not be a problem and apart from that I don't see what is wrong with that rule. Do you know what could be wrong with that rule?
I did feature assignment for all non-terminal parts.

In line 2585 if InternalXText.g, there is the ANTLR rule code derived from the following XText.xtext rule:
logic_assignment :
      id_becomes=identifier_becomes assignment_expr=expr
    | time_becomes=time_becomes assignment_expr=expr
    | id_becomes=identifier_becomes assignment_call_phrase=call_phrase
    | l_par list=data_var_list r_par assign assignment_call_phrase=call_phrase
    | let l_par list=data_var_list r_par be assignment_call_phrase=call_phrase
    | id_becomes=identifier_becomes assignment_new=new_object_phrase;

Again, I don't see anything wrong with that rule. All non-terminal rule calls are assigned to features.

Thanks for any help.
I attached the complete Eclipse project.
Re: antlr issue when compiling grammar [message #760456 is a reply to message #760454] Fri, 02 December 2011 12:52 Go to previous message
Meinte Boersma is currently offline Meinte BoersmaFriend
Messages: 434
Registered: July 2009
Location: Leiden, Netherlands
Senior Member
Check out this blog post to make sure it's not just the time out thing.
If problems persist, you can try to get a good handle on the grammar problems using ANTLRworks. In your case, syntactic predicates might be the way to go to solve them.


Previous Topic:selection of a rule's content
Next Topic:Generate Model Artifacts Programatically
Goto Forum:
  


Current Time: Sat Apr 20 01:37:14 GMT 2024

Powered by FUDForum. Page generated in 0.03512 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top