Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Left factoring
Left factoring [message #492445] Tue, 20 October 2009 09:07 Go to previous message
Eclipse UserFriend
Hi All,

I managed to left factor the most of the code, but am stuck with this one:
//** Test **//
Test:
        "B(" belquery+=Belquery ")"
      | "G(" goalquery+=Goalquery ")"
      | test+=Test "&" test+=Test
      ;


Now I have left factored it like this:
Test:
	  "B(" belquery+=Belquery ")"
	| "G(" goalquery+=Goalquery ")"
	| '(' terminalTest+=TerminalTest ')'
	;
TerminalTest returns Test:
	Test ({Operation.left=current} op='&' right=TerminalTest)?
	;

And this works, but requires the '(' and ')' around the TerminalTest, witch should be left out, but if I remove them the problem is back again.
How to solve this one? I only found some examples like the solution above but I really want to leave the '(' and ')' out.

Thanks in advance.

Best regards,
Tim

[Updated on: Tue, 20 October 2009 09:15] by Moderator

 
Read Message
Read Message
Read Message
Previous Topic:Xtext and the Antlr lexer hell
Next Topic:Adding javadoc like annotation support to a grammar
Goto Forum:
  


Current Time: Mon Jul 21 15:36:54 EDT 2025

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

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

Back to the top