[Grammar] Declaration and definition of variables for a DSL [message #555421] |
Thu, 26 August 2010 10:31  |
Eclipse User |
|
|
|
Hi,
I'm working on a DSL where it should be possible to differ between a declaration of a element and the definition of a element. For example:
int a;
int b = 42;
a = 12;
So, I've started with the following construct
VariableDecl:
type=DataType name=ID ';';
whereas DataType refers to my defined data types. I've thought it might be an idea to use cross references like in the following fragment
VariableDef:
name=[VariableDecl] '=' INT;
But that's not working and I doubt that this is the right way. So far, what I really want is to "extend" the already defined element VariableDecl (and Variable might be a better name). I'm new to Xtext and so this question might be quite stupid. Maybe somebody has an idea or can point me into the right direction? Thanks in advance!
Best regards,
Michael
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.06587 seconds