Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Xtext (Inactive rule generates error)
Xtext [message #1858942] Tue, 02 May 2023 11:23 Go to next message
Eclipse UserFriend
Hi,

The grammar

Instruction:
	from=Identifier '->' to=Identifier
	| 'stack' stack+=Identifier+
;
Execute: 'exec' '{' instructions+=Instruction+ '}';
Identifier: name=ID ( '(' index=Identifier ')' )?;


works fine.

But if I add an inactive rule like:
Instruction:
	from=Identifier '->' to=Identifier
	| 'stack' stack+=Identifier+
;
Execute: 'exec' '{' instructions+=Instruction+ '}';
Identifier: name=ID ( '(' index=Identifier ')' )?;
RuleInError: Execute; // <-- error at generation time with this rule


at generation time, i have the following error:


rule ruleInstruction has non-LL(*) decision due to recursive rule invocations reachable from alts 1,2. Resolve by left-factoring or using syntactic predicates or using backtrack=true option


What is my mistake?

Best regards.

Re: Xtext [message #1858992 is a reply to message #1858942] Thu, 04 May 2023 08:30 Go to previous messageGo to next message
Eclipse UserFriend
have no idea
maybe you can generate a debug grammar and alayze with antlr works

side question: why do you introduce the uncalled rule? to change type hierarchy?
Re: Xtext [message #1859113 is a reply to message #1858992] Fri, 12 May 2023 04:59 Go to previous messageGo to next message
Eclipse UserFriend
Hi Christian,

Called or uncalled rule does not change the problem. I simplified the exposed case for clarity. This is part of a project to convert programs written on mainframe to java. The uncalled rule shown is used for later scoping. Maybe i'm wrong but i think i have to solve this simplified case before generalizing.

I come from mainframe and I'm newcomer to new technologies. Any tips for generating a debug grammar and antlr works?
Re: Xtext [message #1859117 is a reply to message #1859113] Fri, 12 May 2023 05:49 Go to previous message
Eclipse UserFriend
if you want to work on type hierarchy of inferred metamodel you can do this in your example instead

Execute returns RuleInError : {Execute} 'exec' '{' instructions+=Instruction+ '}';
Previous Topic:Include classpath of plugin dependencies in xtext-maven-plugin
Next Topic:Xtext and (binary) backwards compatibility
Goto Forum:
  


Current Time: Sat Apr 26 12:56:30 EDT 2025

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

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

Back to the top