Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Theoretical Question(Xtext and ECore-models)
Theoretical Question [message #713925] Tue, 09 August 2011 12:01 Go to next message
mm  is currently offline mm Friend
Messages: 3
Registered: July 2011
Junior Member
Hi! Sorry for this very theoretical question - the reason for asking it is not relevant and would take too much room here. Maybe it is sufficient to say, I am trying to understand whether Xtext uses the generated Ecore-models, or if they are just a helpful byproduct.
Xtext creates an Ecore-Model when generating artefacts from the defined DSL. Does Xtext internally use this Ecore model for anything directly e.g. for the editor's syntax highlighting etc. or does it use another AST representation?
Thanks!
Re: Theoretical Question [message #713935 is a reply to message #713925] Tue, 09 August 2011 12:34 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13882
Registered: July 2009
Senior Member
Hi,

Xtext uses a "Node Model"/Parsetree too.
And there is a model for the grammar too.
In the old Xtext 1.0.x docs there was a section Working with the Parse Tree (aka Node Model)
but this somehow got lost in 2.0.x

But you can basically use NodeModelUtils to get the nodes for an EObject

~Christian


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Tue, 09 August 2011 12:37]

Report message to a moderator

Re: Theoretical Question [message #713949 is a reply to message #713925] Tue, 09 August 2011 13:24 Go to previous message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3109
Registered: July 2009
Senior Member
Hi,

Xtext uses the produced model internally, too. E.g. validation errors or
broken cross links are propagated from the so called semantic model
(a.k.a. Ecore model) to the offsets and position in the input document.
Other services like the outline directly show the state of the model (at
least in the default implementation).

Christian is right, the node model is another in-memory representation
of the input document that is used, too. This one contains other
information and works basically as a trace from the text to the semantic
model.

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

On 09.08.11 14:01, mm wrote:
> Hi! Sorry for this very theoretical question - the reason for asking it
> is not relevant and would take too much room here. Maybe it is
> sufficient to say, I am trying to understand whether Xtext uses the
> generated Ecore-models, or if they are just a helpful byproduct.
> Xtext creates an Ecore-Model when generating artefacts from the defined
> DSL. Does Xtext internally use this Ecore model for anything directly
> e.g. for the editor's syntax highlighting etc. or does it use another
> AST representation? Thanks!
>
Previous Topic:Xtend with external templates
Next Topic:scoping function is called too late when code completion is expected
Goto Forum:
  


Current Time: Wed Apr 14 12:13:35 GMT 2021

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

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

Back to the top