Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Editor -> Compiler(How to convert a DSL editor/generator in standalone compiler.)
icon5.gif  Editor -> Compiler [message #804336] Wed, 22 February 2012 13:55 Go to next message
Mauro Condarelli is currently offline Mauro CondarelliFriend
Messages: 428
Registered: September 2009
Senior Member
Hi,
I have a plugin (XText/XTend)I use to edit my DSL and generate some code form it each time one DSL file is saved.
So far, so good.

Now that it seems OK I would like to have also a command-line utility to "compile" a [set of] DSL files.
No editing capability.
No graphics.
Possibly small.

Is something like that possible, somehow (without rewriting everything)?

TiA
Mauro
Re: Editor -> Compiler [message #804506 is a reply to message #804336] Wed, 22 February 2012 17:55 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

a) doesn't the builder do it automatically interactively?

b) run your XXXStandaloneSetup.doSetUp(), create an XXXResource from
your text and that will at least do the compile

c) if you want small, the ANTLr is huge

The Xtext model is EBNF with model-annotations that appears to be rather
easy to translate into LALR, so I'm currently developing QVTo and
Acceleo transformations from Xtext to LPG; initially just to get a solid
check that my grammar is not exploiting backtracking, but eventually to
get a 10-fold saving in code size and a 2-fold improvement in speed.

Regards

Ed Willink

On 22/02/2012 13:55, Mauro Condarelli wrote:
> Hi,
> I have a plugin (XText/XTend)I use to edit my DSL and generate some
> code form it each time one DSL file is saved.
> So far, so good.
>
> Now that it seems OK I would like to have also a command-line utility
> to "compile" a [set of] DSL files.
> No editing capability.
> No graphics.
> Possibly small.
>
> Is something like that possible, somehow (without rewriting everything)?
>
> TiA
> Mauro
Re: Editor -> Compiler [message #804590 is a reply to message #804506] Wed, 22 February 2012 20:02 Go to previous messageGo to next message
Mauro Condarelli is currently offline Mauro CondarelliFriend
Messages: 428
Registered: September 2009
Senior Member
Thanks Ed,
comments below.

Regards
Mauro

On 22/02/2012 18:55, Ed Willink wrote:
> Hi
>
> a) doesn't the builder do it automatically interactively?
Of course, but what I'm looking for is a kind of command-line tool which
should accept a list of DSL files as arguments and produce the generated
files in a suitable dir (either "$(pwd)/src-gen" or "-o whatever"),
possibly taking care of creation of a "Xtext project", if needed.

>
> b) run your XXXStandaloneSetup.doSetUp(), create an XXXResource from
> your text and that will at least do the compile
Can You elaborate, please?
Should I write a "static main()" to create an SIDLResource and then call
SIDELStandaloneSetup.doSetUp()?
Is that all?

>
> c) if you want small, the ANTLr is huge
I know, but it's much smaller than a complete eclipse installation,
especially if you consider I would need EMF, Xtext, Xtend, ...

>
> The Xtext model is EBNF with model-annotations that appears to be rather
> easy to translate into LALR, so I'm currently developing QVTo and
> Acceleo transformations from Xtext to LPG; initially just to get a solid
> check that my grammar is not exploiting backtracking, but eventually to
> get a 10-fold saving in code size and a 2-fold improvement in speed.
I'm looking for something easyly derivable from my current code (which
is working well).


>
> Regards
>
> Ed Willink
>
> On 22/02/2012 13:55, Mauro Condarelli wrote:
>> Hi,
>> I have a plugin (XText/XTend)I use to edit my DSL and generate some
>> code form it each time one DSL file is saved.
>> So far, so good.
>>
>> Now that it seems OK I would like to have also a command-line utility
>> to "compile" a [set of] DSL files.
>> No editing capability.
>> No graphics.
>> Possibly small.
>>
>> Is something like that possible, somehow (without rewriting everything)?
>>
>> TiA
>> Mauro
>
Re: Editor -> Compiler [message #804601 is a reply to message #804506] Wed, 22 February 2012 20:02 Go to previous messageGo to next message
Mauro Condarelli is currently offline Mauro CondarelliFriend
Messages: 428
Registered: September 2009
Senior Member
Thanks Ed,
comments below.

Regards
Mauro

On 22/02/2012 18:55, Ed Willink wrote:
> Hi
>
> a) doesn't the builder do it automatically interactively?
Of course, but what I'm looking for is a kind of command-line tool which
should accept a list of DSL files as arguments and produce the generated
files in a suitable dir (either "$(pwd)/src-gen" or "-o whatever"),
possibly taking care of creation of a "Xtext project", if needed.

>
> b) run your XXXStandaloneSetup.doSetUp(), create an XXXResource from
> your text and that will at least do the compile
Can You elaborate, please?
Should I write a "static main()" to create an SIDLResource and then call
SIDELStandaloneSetup.doSetUp()?
Is that all?

>
> c) if you want small, the ANTLr is huge
I know, but it's much smaller than a complete eclipse installation,
especially if you consider I would need EMF, Xtext, Xtend, ...

>
> The Xtext model is EBNF with model-annotations that appears to be rather
> easy to translate into LALR, so I'm currently developing QVTo and
> Acceleo transformations from Xtext to LPG; initially just to get a solid
> check that my grammar is not exploiting backtracking, but eventually to
> get a 10-fold saving in code size and a 2-fold improvement in speed.
I'm looking for something easyly derivable from my current code (which
is working well).


>
> Regards
>
> Ed Willink
>
> On 22/02/2012 13:55, Mauro Condarelli wrote:
>> Hi,
>> I have a plugin (XText/XTend)I use to edit my DSL and generate some
>> code form it each time one DSL file is saved.
>> So far, so good.
>>
>> Now that it seems OK I would like to have also a command-line utility
>> to "compile" a [set of] DSL files.
>> No editing capability.
>> No graphics.
>> Possibly small.
>>
>> Is something like that possible, somehow (without rewriting everything)?
>>
>> TiA
>> Mauro
>
Re: Editor -> Compiler [message #804665 is a reply to message #804590] Wed, 22 February 2012 21:44 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

On 22/02/2012 20:02, Mauro Condarelli wrote:
> b) run your XXXStandaloneSetup.doSetUp(), create an XXXResource from
> your text and that will at least do the compile
> Can You elaborate, please?
> Should I write a "static main()" to create an SIDLResource and then call
> SIDELStandaloneSetup.doSetUp()?
> Is that all?
The other way around. SIDELStandaloneSetup.doSetUp() ensures that Xtext
support is registered for *.sidel files, so that a ResourceSet will
automatically create an Xtext Resource from a text stream.
>> c) if you want small, the ANTLr is huge
> I know, but it's much smaller than a complete eclipse installation,
> especially if you consider I would need EMF, Xtext, Xtend, ...
You won't easily get rid of EMF (or Xtend). Xtext might be optional for
compile-only.
>> The Xtext model is EBNF with model-annotations that appears to be rather
>> easy to translate into LALR, so I'm currently developing QVTo and
>> Acceleo transformations from Xtext to LPG; initially just to get a solid
>> check that my grammar is not exploiting backtracking, but eventually to
>> get a 10-fold saving in code size and a 2-fold improvement in speed.
> I'm looking for something easyly derivable from my current code (which
> is working well).
My aim is to exploit Xtext for editors and re-use the grammar for a more
compact LPG-based parser. You would just add an 'LpgParserFragment' to
your MWE workflow so that your Xtext grammar is converted to an LPG
parser. Don't wait for it.

Regards

Ed Willink
Re: Editor -> Compiler [message #804947 is a reply to message #804590] Thu, 23 February 2012 07:06 Go to previous message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1823
Registered: July 2009
Senior Member
Am 2/22/12 9:02 PM, schrieb Mauro Condarelli:
> Thanks Ed,
> comments below.
>
> Regards
> Mauro
>
> On 22/02/2012 18:55, Ed Willink wrote:
>> Hi
>>
>> a) doesn't the builder do it automatically interactively?
> Of course, but what I'm looking for is a kind of command-line tool which
> should accept a list of DSL files as arguments and produce the generated
> files in a suitable dir (either "$(pwd)/src-gen" or "-o whatever"),
> possibly taking care of creation of a "Xtext project", if needed.

There no such command line tool, but it's generally possible to build one.
For that you need to
1) create an injector using the StandaloneSetup (as Ed suggested),
2) obtain a ResourceSet from the created injector,
3) obtain an instance of IGenerator
4) -"- and instance of IFileSystemAccess
5) load the models you want to generate code for into the resourceset
6) invoke the generator using the resources and the file system access

I might have forgotten something. Just ask if you got stuck.
Also if you are able to generalize this a bit we are happy to accept
contributions :-)

Sven

--
Need professional support for Xtext or other Eclipse Modeling technologies?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : http://blog.efftinge.de
Previous Topic:Using an Xtext editor for maninpulating an Ecore model
Next Topic:referencing other xtext files in standalone execution of IGenerator
Goto Forum:
  


Current Time: Wed Apr 24 23:34:41 GMT 2024

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

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

Back to the top