Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Variable declaration (create dsl with xtext)
Variable declaration [message #899570] Wed, 01 August 2012 09:25 Go to previous message
Laigle jérôme is currently offline Laigle jérôme
Messages: 26
Registered: August 2012
Junior Member
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:

dcl a%=10
dcl b% = 42
a = 12
b=30
b=a

So, I've started with the following construct

VariableName:
name=ID type=Type
;

VariableDeclaration :
'dcl' variableName=VariableName

;
VariableReference:
variableName=[VariableName|ID]
;

VariableAssignment:
variable=[VariableReference] '=' value=VariableValue
;

VariableValue:
{VariableValue}
(variableReference =VariableReference)?
//(value=Value)?
(value=NUMBER)?
;

whereas Type refers to my defined types. I've thought it might be an idea to use cross references like in the following fragment

VariableDef:
name=[VariableDeclaration] '=' INT;

But that's not working and I doubt that this is the right way. 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,
Jérôme
 
Read Message
Read Message
Read Message
Read Message
Previous Topic:How to extend Xtext DSL to use a validation class packaged with a library model ?
Next Topic:Save event XtextEditor
Goto Forum:
  


Current Time: Tue May 21 06:07:27 EDT 2013

Powered by FUDForum. Page generated in 0.02011 seconds