Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Xtext (Inactive rule generates error)
Xtext [message #1858942] Tue, 02 May 2023 15:23 Go to next message
Luong Tiet is currently offline Luong TietFriend
Messages: 4
Registered: May 2023
Junior Member
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 12:30 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
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?


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext [message #1859113 is a reply to message #1858992] Fri, 12 May 2023 08:59 Go to previous messageGo to next message
Luong Tiet is currently offline Luong TietFriend
Messages: 4
Registered: May 2023
Junior Member
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 09:49 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
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+ '}';


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Include classpath of plugin dependencies in xtext-maven-plugin
Next Topic:Xtext and (binary) backwards compatibility
Goto Forum:
  


Current Time: Thu Apr 25 13:19:53 GMT 2024

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

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

Back to the top