Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Grammar w. hundreds of message types(Standalone Java application with a grammar of hundreds of message types)
Grammar w. hundreds of message types [message #697843] Mon, 18 July 2011 07:49 Go to next message
FJ  Stöver is currently offline FJ StöverFriend
Messages: 25
Registered: July 2011
Location: Aachen, Germany
Junior Member
Dear colleagues,

I'm a newbie in Xtext and currently investigating whether Xtext is suited for our use case 'Standalone Java application to parse a grammar of hundreds of message types'.

For maintaineability I would like to define every message type in a separate grammar file (.xtext file? separate project?) and finally have a grammar file that brings them all together. Is that possible, and how?

I've experimented with 'Xtext-project' for one messagedefinition and 'Xtext project from existing ecore models' to link to that message, but got lost in making the latter project reuse the grammar from the first one. I'm not even shure whether that's a suitable approach.

I didn't find a solution in the newsgroups so I start a new topic what is hopefully the right way.

Any hints are wellcome. Thanks for your cooperation.

Kind regards Franz-Josef
Re: Grammar w. hundreds of message types [message #698077 is a reply to message #697843] Mon, 18 July 2011 18:14 Go to previous messageGo to next message
Alexander Nittka is currently offline Alexander NittkaFriend
Messages: 1193
Registered: July 2009
Senior Member
Hi,

do you have an existing meta model that is to be instantiated? Are you sure you need to distinguish the hundreds of message types on the grammar level?

Xtext allows only single grammar inheritance, so you'd have to have a very long chain. It might be an option to have a "dummy" grammar for every message type but combine them automatically into one (generated) grammar that is then used to build the language infrastructure.

Alex

P.S.: Modularising a language or distributing it over multiple files isn't really the first thing one would want to do with Xtext.


Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext@itemis.de
Re: Grammar w. hundreds of message types [message #699319 is a reply to message #698077] Thu, 21 July 2011 10:45 Go to previous message
FJ  Stöver is currently offline FJ StöverFriend
Messages: 25
Registered: July 2011
Location: Aachen, Germany
Junior Member
Hi Alexander,

thanks for your reply.

I think I'll follow your advice from a different thread "... it might be a cleaner solution to have different xtext-grammars and have a (custom-self-implemented) preprocessing step that copies the rules into a combined grammar and uses that one. This is not without problems, e.g. if you have cross references to types that are not defined in the current file." (from ... index.php/t/212433/)

or

I'll split the stuff into different grammars, parse the head of my input manually to decide which grammar to feed with the rest of the input.

kind regards Franz-Josef
Previous Topic:Reuse content assist from other EMF models
Next Topic:[Xbase] Rewriting an expression to conform to expected type
Goto Forum:
  


Current Time: Sat Sep 19 20:33:00 GMT 2020

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

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

Back to the top