Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » GMT (Generative Modeling Technologies) » [TCS] running samples, compiler, runtime
[TCS] running samples, compiler, runtime [message #378058] Mon, 28 May 2007 19:40 Go to next message
Eclipse UserFriend
Originally posted by: browngr3.msu.edu

Hello,

I have been looking at the SampleDSL and TCSToolkit examples. I have not
run them, as I have been trying to figure out how they work by reading
the file. Anyway, I am not sure how to run them. It seems that ant is
needed, but is there some sort of special context, such as inside
Eclipse, in which these have to be run? Is there some other components
that are necessary for making these work? Specifically, I am not sure
what the "am3.loadModel" refers to or where to find it.

I read through Frederic Jouault's, et al, paper "TCS: a DSL for the
Specification ..." and it
mentions an injector and extractor necessary for using TCS. (I also
noticed these things in the SampleDSL example.) The injector and
extractor are compiled by the compiler based on a custom-written TCS
model, correct?

I can't seem to figure out what comprises these things (compiler,
runtime, extractor, injector). Could you please point me to the jar
files/packages that contain these things?

In the SampleDSL example, there is an AddressBook-Importer.jar file and
there is a TCS-importer.jar in the TCSInjector example. What
functionality do these jar files provide?

Another thing: the paper, "TCS: a DSL for the Specification ...",
discussed TCS and KM3 together. I don't have to use KM3 in my scenario,
if I have the source and target metamodels in ecore and have a
custom-written TCS model, do I?

Sorry if these are silly, basic, newbie questions.

Thanks,

Greg Brown
Re: [TCS] running samples, compiler, runtime [message #378060 is a reply to message #378058] Mon, 28 May 2007 20:16 Go to previous message
Frédéric Jouault is currently offline Frédéric JouaultFriend
Messages: 572
Registered: July 2009
Senior Member
Hi Greg,

> I have been looking at the SampleDSL and TCSToolkit examples. I have not
> run them, as I have been trying to figure out how they work by reading
> the file. Anyway, I am not sure how to run them. It seems that ant is
> needed, but is there some sort of special context, such as inside
> Eclipse, in which these have to be run? Is there some other components
> that are necessary for making these work? Specifically, I am not sure
> what the "am3.loadModel" refers to or where to find it.

You can use TCS programmatically (i.e., from Java code, inside or
outside of Eclipse):
http://wiki.eclipse.org/index.php/ATL_Howtos#How_do_I_launch _transformations_programmatically.3F

Or, you can use it from ant scripts, thanks to the AM3 ant tasks:
http://wiki.eclipse.org/index.php/AM3_Ant_Tasks

The ant tasks have only been tested from within Eclipse so far, but it
should not be that hard to make them work outside of it.

My advice is that you try to run them within Eclipse, and observe how it
works. Anyway, even if you ultimately want to use your transformation
scenario outside of Eclipse, you should probably develop it within Eclipse.


> I read through Frederic Jouault's, et al, paper "TCS: a DSL for the
> Specification ..." and it
> mentions an injector and extractor necessary for using TCS. (I also
> noticed these things in the SampleDSL example.) The injector and
> extractor are compiled by the compiler based on a custom-written TCS
> model, correct?

The injector is composed of a language-independent Java class
(EBNFInjector2 implements Injector), and of a language-dependent parser
(<MM>-importer.jar). This parser is compiled from an ANTLR grammar,
itself generated from the TCS model and KM3 metamodel for your language.

The extractor is currently a Java class (EBNFExtractor implements
Extractor) that interprets the TCS model, and pretty prints its source
to a program.

You can call both of them programmatically, or from ant tasks (i.e.,
using the <injector> and <extractor> elements, respectively children of
am3.loadModel and am3.saveModel).


> I can't seem to figure out what comprises these things (compiler,
> runtime, extractor, injector). Could you please point me to the jar
> files/packages that contain these things?

The runtimes (i.e., EBNFInjector2, EBNFExtractor, and their
dependencies) are in the org.eclipse.m2m.atl.engine plugin. Of course,
you also need the plugins on which this plugin depends. For instance,
you need org.eclipse.m2m.atl.engine.vm, which defines the interfaces for
model handlers (ASMModel, ASMModelElement), injectors (Injector), and
extractors (Extractor).

The information available in this howto entry:
http://wiki.eclipse.org/index.php/ATL_Howtos#How_do_I_launch _transformations_programmatically.3F
includes a set of jars files, although only a subset is probably
strictly necessary if you only want to use TCS.


> In the SampleDSL example, there is an AddressBook-Importer.jar file and
> there is a TCS-importer.jar in the TCSInjector example. What
> functionality do these jar files provide?

These jars correspond to the parser part of the injector.
<MM>-importer.jar (where <MM> is the name of your language/metamodel) is
generated from a pair (KM3 metamodel, TCS model).

The TCSSample project (from http://wiki.eclipse.org/index.php/TCS) lets
you compile your KM3+TCS into a <MM>-importer.jar parser using ant scripts.


> Another thing: the paper, "TCS: a DSL for the Specification ...",
> discussed TCS and KM3 together. I don't have to use KM3 in my scenario,
> if I have the source and target metamodels in ecore and have a
> custom-written TCS model, do I?

The TCS compiler (i.e., the KM3+TCS to ANTLR transformation, written in
ATL) needs to have a metamodel as source, in addition to the TCS model.
A previous version of this transformation used MOF 1.4, but this was
somewhat tied to one implementation technology (i.e., Netbeans/MDR).

When we moved to Eclipse/EMF, instead of tying this transformation to
Ecore, we used KM3. One of the purposes of KM3 is to be used in such a
way: as a pivot (another purpose being to have a nice, simple, textual
syntax, and yet another purpose being to have a simple metamodel to give
precise semantics to).

If your metamodel is not specified in KM3, you will simply need to
transform it in KM3. For instance, if it is in Ecore, then you apply the
Ecore2KM3 transformation, which is available from the contextual menu on
..ecore files within Eclipse.

You can of course use this Ecore2KM3 transformation, and compile TCS,
outside of Eclipse. However, this is usually not necessary: whereas you
may need to package your finished transformation for usage outside of
Eclipse, it is quite convenient to develop it from within Eclipse.


> Sorry if these are silly, basic, newbie questions.

Well, I cannot say that your questions are silly or basic because the
current documentation on TCS is still work in progress, and does not
contain much details on the topics you asked about.

We are probably going to reuse some of your questions, as well as their
corresponding answers, to start a FAQ on TCS. Therefore, you are
actually helping the community with your questions ;-).

And of course, feel free to contribute to the Wiki, and answer questions
on this newsgroup, once you are familiar with TCS ;-). You may also
consider publishing your scenario on the Eclipse website (e.g., as an
ATL use case (see http://www.eclipse.org/m2m/atl/usecases/).


Best regards,

Frédéric Jouault
Re: [TCS] running samples, compiler, runtime [message #599761 is a reply to message #378058] Mon, 28 May 2007 20:16 Go to previous message
Frédéric Jouault is currently offline Frédéric JouaultFriend
Messages: 572
Registered: July 2009
Senior Member
Hi Greg,

> I have been looking at the SampleDSL and TCSToolkit examples. I have not
> run them, as I have been trying to figure out how they work by reading
> the file. Anyway, I am not sure how to run them. It seems that ant is
> needed, but is there some sort of special context, such as inside
> Eclipse, in which these have to be run? Is there some other components
> that are necessary for making these work? Specifically, I am not sure
> what the "am3.loadModel" refers to or where to find it.

You can use TCS programmatically (i.e., from Java code, inside or
outside of Eclipse):
http://wiki.eclipse.org/index.php/ATL_Howtos#How_do_I_launch _transformations_programmatically.3F

Or, you can use it from ant scripts, thanks to the AM3 ant tasks:
http://wiki.eclipse.org/index.php/AM3_Ant_Tasks

The ant tasks have only been tested from within Eclipse so far, but it
should not be that hard to make them work outside of it.

My advice is that you try to run them within Eclipse, and observe how it
works. Anyway, even if you ultimately want to use your transformation
scenario outside of Eclipse, you should probably develop it within Eclipse.


> I read through Frederic Jouault's, et al, paper "TCS: a DSL for the
> Specification ..." and it
> mentions an injector and extractor necessary for using TCS. (I also
> noticed these things in the SampleDSL example.) The injector and
> extractor are compiled by the compiler based on a custom-written TCS
> model, correct?

The injector is composed of a language-independent Java class
(EBNFInjector2 implements Injector), and of a language-dependent parser
(<MM>-importer.jar). This parser is compiled from an ANTLR grammar,
itself generated from the TCS model and KM3 metamodel for your language.

The extractor is currently a Java class (EBNFExtractor implements
Extractor) that interprets the TCS model, and pretty prints its source
to a program.

You can call both of them programmatically, or from ant tasks (i.e.,
using the <injector> and <extractor> elements, respectively children of
am3.loadModel and am3.saveModel).


> I can't seem to figure out what comprises these things (compiler,
> runtime, extractor, injector). Could you please point me to the jar
> files/packages that contain these things?

The runtimes (i.e., EBNFInjector2, EBNFExtractor, and their
dependencies) are in the org.eclipse.m2m.atl.engine plugin. Of course,
you also need the plugins on which this plugin depends. For instance,
you need org.eclipse.m2m.atl.engine.vm, which defines the interfaces for
model handlers (ASMModel, ASMModelElement), injectors (Injector), and
extractors (Extractor).

The information available in this howto entry:
http://wiki.eclipse.org/index.php/ATL_Howtos#How_do_I_launch _transformations_programmatically.3F
includes a set of jars files, although only a subset is probably
strictly necessary if you only want to use TCS.


> In the SampleDSL example, there is an AddressBook-Importer.jar file and
> there is a TCS-importer.jar in the TCSInjector example. What
> functionality do these jar files provide?

These jars correspond to the parser part of the injector.
<MM>-importer.jar (where <MM> is the name of your language/metamodel) is
generated from a pair (KM3 metamodel, TCS model).

The TCSSample project (from http://wiki.eclipse.org/index.php/TCS) lets
you compile your KM3+TCS into a <MM>-importer.jar parser using ant scripts.


> Another thing: the paper, "TCS: a DSL for the Specification ...",
> discussed TCS and KM3 together. I don't have to use KM3 in my scenario,
> if I have the source and target metamodels in ecore and have a
> custom-written TCS model, do I?

The TCS compiler (i.e., the KM3+TCS to ANTLR transformation, written in
ATL) needs to have a metamodel as source, in addition to the TCS model.
A previous version of this transformation used MOF 1.4, but this was
somewhat tied to one implementation technology (i.e., Netbeans/MDR).

When we moved to Eclipse/EMF, instead of tying this transformation to
Ecore, we used KM3. One of the purposes of KM3 is to be used in such a
way: as a pivot (another purpose being to have a nice, simple, textual
syntax, and yet another purpose being to have a simple metamodel to give
precise semantics to).

If your metamodel is not specified in KM3, you will simply need to
transform it in KM3. For instance, if it is in Ecore, then you apply the
Ecore2KM3 transformation, which is available from the contextual menu on
..ecore files within Eclipse.

You can of course use this Ecore2KM3 transformation, and compile TCS,
outside of Eclipse. However, this is usually not necessary: whereas you
may need to package your finished transformation for usage outside of
Eclipse, it is quite convenient to develop it from within Eclipse.


> Sorry if these are silly, basic, newbie questions.

Well, I cannot say that your questions are silly or basic because the
current documentation on TCS is still work in progress, and does not
contain much details on the topics you asked about.

We are probably going to reuse some of your questions, as well as their
corresponding answers, to start a FAQ on TCS. Therefore, you are
actually helping the community with your questions ;-).

And of course, feel free to contribute to the Wiki, and answer questions
on this newsgroup, once you are familiar with TCS ;-). You may also
consider publishing your scenario on the Eclipse website (e.g., as an
ATL use case (see http://www.eclipse.org/m2m/atl/usecases/).


Best regards,

Frédéric Jouault
Previous Topic:[TCS] running samples, compiler, runtime
Next Topic:[Xpand] properties with the same name as keywords
Goto Forum:
  


Current Time: Tue Apr 16 18:06:52 GMT 2024

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

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

Back to the top