|
Re: Using Xtext to populate memody model [message #997931 is a reply to message #997820] |
Wed, 09 January 2013 02:22 |
Henrik Lindberg Messages: 2509 Registered: July 2009 |
Senior Member |
|
|
On 2013-08-01 22:11, Patrick Shea wrote:
> Hi, I'm new to Xtext but not to antlr, I used antlr in the past to parse
> dsl and create a java model in memory.
>
> I like what Xtext is doing and saw the code generator example but I
> don't see how I could generate objects at parse time.
>
> I must be missing some step to accomplish this...
There is no step... simple load the file into an EMF resource set and
the parser will be triggered, parse, link, etc. and give you the model
contents.
Also, other models can simply refer to model elements in the created
model without knowing that it is in fact a text based DSL.
How you do this differs slightly depending on if you are running inside
the IDE (while editing etc.) or if you want some stand alone tool that
performs the reading.
If you want to read the model for purpose of "building", the best way is
to hook into the Xtext builder framework - thus getting a callback when
things change, simply read the model and do whatever you want.
Need to know a bit more about what you want to do in order to be more
specific.
Hope this helps along the way.
Regards
- henrik
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03218 seconds