Non-LL1 Grammar handling with JvmTypes [message #810326] |
Thu, 01 March 2012 00:55 |
Jens-Uwe Moeller 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
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03480 seconds