Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Non-LL1 Grammar handling with JvmTypes(Do you have any ideas?)
Non-LL1 Grammar handling with JvmTypes [message #810326] Thu, 01 March 2012 00:55 Go to next message
Jens-Uwe Moeller is currently offline Jens-Uwe MoellerFriend
Messages: 12
Registered: March 2012
Location: Hamburg
Junior Member
Hi,

i would like to define a kind of type definition using xtext, that may either refer to a JvmTypeReference or to an already defined type.

My first idea for the rule looks like
MyTypeDecl returns MyTypeDecl:
	{MyTypeDecl} 'type' name=ValidID 
	(':' type=JvmTypeReference |
	 ':' typesuper=[PmDslTypeDecl]
	);


I know, that a solution could be to use different keywords, like
MyTypeDecl returns MyTypeDecl:
	{MyTypeDecl} 'type' name=ValidID 
	('is' type=JvmTypeReference |
	 'extends' typesuper=[PmDslTypeDecl]
	);

but that is not the solution, I am looking for, as it delegates the problem to the user of my language.

In documentation chapter "The Grammar Language" was a hint to use backtracking, but it was not explained.

I suppose, that this problem is so common, that you already know an elegant solution.

Jens
Re: Non-LL1 Grammar handling with JvmTypes [message #810337 is a reply to message #810326] Thu, 01 March 2012 01:22 Go to previous messageGo to next message
Jens-Uwe Moeller is currently offline Jens-Uwe MoellerFriend
Messages: 12
Registered: March 2012
Location: Hamburg
Junior Member
Just meant LR1, not LL1, sorry. Jens
Re: Non-LL1 Grammar handling with JvmTypes [message #877500 is a reply to message #810326] Sat, 26 May 2012 21:56 Go to previous messageGo to next message
Christian Mauceri is currently offline Christian MauceriFriend
Messages: 22
Registered: May 2012
Location: Paris
Junior Member
I have exactly the same problem and I would be very interested in a solution Smile

[Updated on: Sun, 27 May 2012 14:10]

Report message to a moderator

Re: Non-LL1 Grammar handling with JvmTypes [message #877764 is a reply to message #877500] Sun, 27 May 2012 17:15 Go to previous message
Christian Mauceri is currently offline Christian MauceriFriend
Messages: 22
Registered: May 2012
Location: Paris
Junior Member
I found the solution in the excellent post : Five simple steps to your JVM language, I can't post the link here because I'm a newbie Sad
Make your objects part of JvmType using JvmModelInferrer.

[Updated on: Sun, 27 May 2012 17:30]

Report message to a moderator

Previous Topic:Question concerning grammar
Next Topic:IOConsole Listener
Goto Forum:
  


Current Time: Fri Apr 19 05:47:28 GMT 2024

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

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

Back to the top