Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Using Xtext as a textual concrete syntax tool(How to generate a language toolset (parser and grammer) from an Ecore metamodel)
Using Xtext as a textual concrete syntax tool [message #1743493] Thu, 15 September 2016 23:13 Go to next message
Eclipse UserFriend
Hello,

I used Xtext a long time ago for generating a textual language as a first step. This time, I want to follow a different working approach.

As the first step, I want to define a metamodel as an ECore model. Then, using Xtext, I want to define a textual syntax for this metamodel. Please note that, the .ecore model (metamodel) exists before the grammar in this case. The .ecore model is NOT generated from the textual syntax/grammar.

At the end, since I have a defined textual syntax/grammar for my metadodel, I wish to have an automatically generated parser, that can be called through a Java application.

In other words, I will give a textual file input that is basically an instance of this textual language to my Java program that can use the automatically generated parser. Then, I will get an instance of my ECore model (metamodel) at the end.

Could you guide me for this?

Thank you.

Re: Using Xtext as a textual concrete syntax tool [message #1743498 is a reply to message #1743493] Fri, 16 September 2016 03:17 Go to previous messageGo to next message
Neeraj Bhusare is currently offline Neeraj BhusareFriend
Messages: 177
Registered: July 2009
Location: Canada
Senior Member
Hi Bugar,

The latest Xtext wizard allows you to select an "existing ecore" model and generates the grammar for your language. Please see - File -> New -> Xtext -> Xtext Project From Existing Ecore model. Once you have the grammar, you can generate rest of the infrastructure code using - Generate Xtext Artifacts.

The following link should help you with loading the serialized model in your Java program - https://wiki.eclipse.org/Xtext/FAQ#How_do_I_load_my_model_in_a_standalone_Java_application.C2.A0.3F

Hope this helps.

Tx


Twitter : @NeerajBhusare
Blog : https://nbhusare.github.io/
Best regards, Neeraj

[Updated on: Fri, 16 September 2016 03:24]

Report message to a moderator

Re: Using Xtext as a textual concrete syntax tool [message #1743523 is a reply to message #1743498] Fri, 16 September 2016 08:03 Go to previous messageGo to next message
Jan Koehnlein is currently offline Jan KoehnleinFriend
Messages: 760
Registered: July 2009
Location: Hamburg
Senior Member
Browse the documentation for 'EPackage Import' and 'Integration with EMF'

---
Get professional support from the Xtext committers at www.typefox.io
Re: Using Xtext as a textual concrete syntax tool [message #1743529 is a reply to message #1743523] Fri, 16 September 2016 08:48 Go to previous message
Eclipse UserFriend
Thanks a lot for the help. I will check it out and come back soon if I need any further help Smile.
Previous Topic:Split grammar based text into 2 editors
Next Topic:Accessing java annotations using Xtext/XBase
Goto Forum:
  


Current Time: Fri Apr 26 18:40:20 GMT 2024

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

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

Back to the top