Home » Modeling » TMF (Xtext) » Could you do Pascal in XText
Could you do Pascal in XText [message #30710] |
Fri, 27 February 2009 09:06  |
Eclipse User |
|
|
|
Hi all,
A quick question: would XText be able to cope with a grammar as big as
that of Pascal? Will the result be usable performance wise?
Thanks,
Tonny Madsen
|
|
| |
Re: Could you do Pascal in XText [message #30787 is a reply to message #30753] |
Sun, 01 March 2009 16:12   |
Eclipse User |
|
|
|
Well, we might do just that as a first version for a Pascal editor as
Xtext seems to provide all the functionality that is asked for for now.
We already have the ANTLR grammar in place :-), so we really just have
to try. If we do try this out for real, then be sure that we will notify
you of any results...
Thanks,
Tonny
Sven Efftinge wrote:
> Hi Tonny,
>
> I don't know pascal good enough to say whether it can be parsed with TMF
> Xtext at all. But after having a quick look over the corresponding
> Antlr 2 grammar (http://www.antlr.org/grammar/pascal/pascal.g), I'ld say
> yes.
> Regarding performance : Usually, the size of the files and the
> implementation of the static analysis and linking is more important than
> the size of the grammar.
> We haven't tried to implement a general purpose programming language
> with TMF Xtext so far. Would be very interesting to see that ;-).
>
> Cheers,
> Sven
>
>
> Tonny Madsen schrieb:
>> Hi all,
>>
>> A quick question: would XText be able to cope with a grammar as big as
>> that of Pascal? Will the result be usable performance wise?
>>
>> Thanks,
>> Tonny Madsen
|
|
|
Newbie - EMF/ANTLR or xtext? [message #31423 is a reply to message #30787] |
Wed, 11 March 2009 09:57   |
Eclipse User |
|
|
|
Hi there,
My name is Christophe Bouhier, I am working on a rather large
application with RCP, EMF, GMF etc...
For the last few weeks, I was trying to generate code from a DSL which
can "act" on my EMF model. "act" here is defined as query, process and
write back to EMF.
I am using ANTLRv3, created a grammar, AST and working on templates to
generate OCL to do the "acting".
On top, I have been trough the hassle to define a text editor, which can
enrich my DSL. (syntaxhighlighting etc...)
Now, I asked a question on the EMF forum, if this a good approach, and
I was pointed out to the xtext project which I didn't know about.
At a first glance, xtext seems to be what I need, and I wouldn't need to
be bothered with the DSL text editor. (Bummer, how can I have missed out
on this project!).
Looking at the documentation, I am however uncertain if xtext can cover
my requirements. So, I turn to you and ask:
- xtext looks very similar to antlrv3 grammar, but seems to have
simplications, is it somewhere documented what the differences are?
- as discussed in the thread on pascal.g below, my DSL is also as rich
as a general purpose language, so would xtext be able to handle a
complex language with flow statements (if, for, while, switch) and other
language constructs (OO like inheritance, woudln't be required tough, so
it's somewhat simplified)?
- xtext seems to have been conceived to create a model (I read Sven's
blog on diagram vs text for modelling. My requirement is not to model,
as I did use text already (.XSD) :-) but to perform operations on the
model. Does xtext fit the bill?
- What does xtext provide, to perform what I defined as "acting" on the
model? (Do I need to generate OCL templates to "act" on my model?, is
there an alternative)
Please help me understand if what I need can be achieved xtext
Thanks, Christophe
Tonny Madsen wrote:
> Well, we might do just that as a first version for a Pascal editor as
> Xtext seems to provide all the functionality that is asked for for now.
>
> We already have the ANTLR grammar in place :-), so we really just have
> to try. If we do try this out for real, then be sure that we will notify
> you of any results...
>
> Thanks,
> Tonny
>
> Sven Efftinge wrote:
>> Hi Tonny,
>>
>> I don't know pascal good enough to say whether it can be parsed with
>> TMF Xtext at all. But after having a quick look over the
>> corresponding Antlr 2 grammar
>> (http://www.antlr.org/grammar/pascal/pascal.g), I'ld say yes.
>> Regarding performance : Usually, the size of the files and the
>> implementation of the static analysis and linking is more important
>> than the size of the grammar.
>> We haven't tried to implement a general purpose programming language
>> with TMF Xtext so far. Would be very interesting to see that ;-).
>>
>> Cheers,
>> Sven
>>
>>
>> Tonny Madsen schrieb:
>>> Hi all,
>>>
>>> A quick question: would XText be able to cope with a grammar as big
>>> as that of Pascal? Will the result be usable performance wise?
>>>
>>> Thanks,
>>> Tonny Madsen
|
|
|
Re: Newbie - EMF/ANTLR or xtext? [message #31459 is a reply to message #31423] |
Wed, 11 March 2009 12:00   |
Eclipse User |
|
|
|
Hi Christophe,
I'll comment inline...
>
> I am using ANTLRv3, created a grammar, AST and working on templates to
> generate OCL to do the "acting".
I'm not sure I understand. Do you have a language, which operates
against EMF models, i.e. Ecore is the typesystem?
> - xtext looks very similar to antlrv3 grammar, but seems to have
> simplications, is it somewhere documented what the differences are?
Well it's not completely documented yet. Updating the documentation is a
highly prioritized task for the upcoming M7.
The available documentation can be found here
http://wiki.eclipse.org/Xtext/Documentation
>
> - as discussed in the thread on pascal.g below, my DSL is also as rich
> as a general purpose language, so would xtext be able to handle a
> complex language with flow statements (if, for, while, switch) and other
> language constructs (OO like inheritance, woudln't be required tough, so
> it's somewhat simplified)?
We don't have new insights regarding this, so we still are pretty sure
that it shouldn't be a problem.
>
> - xtext seems to have been conceived to create a model (I read Sven's
> blog on diagram vs text for modelling. My requirement is not to model,
> as I did use text already (.XSD) :-) but to perform operations on the
> model. Does xtext fit the bill?
Xtext "just" provides textual syntax including IDE support for existing
ecore models. So the parser creates an EMF model which can than further
be used for anything.
Eclipse Modeling provides a vast number of different languages and
solutions to process EMF models. One is OCL another is M2T Xpand, which
Xtext itself uses for code generation.
>
> - What does xtext provide, to perform what I defined as "acting" on the
> model? (Do I need to generate OCL templates to "act" on my model?, is
> there an alternative)
There are two different ways of "acting on models".
Code generation: Can be done e.g with Xpand
Interpretation : Usually done with Java (use the Switch class EMF
generates for you) as well as OCL, Xpand'x expression language, etc.
Xtext itself does not provide a specific solution, as there are
solutions available.
regards,
Sven
|
|
|
Re: Newbie - EMF/ANTLR or xtext? [message #31564 is a reply to message #31459] |
Thu, 12 March 2009 04:51   |
Eclipse User |
|
|
|
Hi Sven,
Thanks for the response, see my reply inline.
Sven Efftinge wrote:
>
> I'm not sure I understand. Do you have a language, which operates
> against EMF models, i.e. Ecore is the typesystem?
Yes, the model represents a telecom network.
define Router{
traffic_in = DEFAULT_TRAFFIC
traffic_out = traffic_in - DROPPED_PACKETS
}
So "Router", "traffic_in", "DEFAULT_TRAFFIC" are all EMF elements
somewhere in the EMF model tree.
So the user would write these scripts instead of OCL or any other way to
read and write to EMF.
The scripts are written and interpreted at runtime, so building in
these rules into the EMF model itself when building the model is not an
option.
>
> Well it's not completely documented yet. Updating the documentation is a
> highly prioritized task for the upcoming M7.
> The available documentation can be found here
> http://wiki.eclipse.org/Xtext/Documentation
Ok, will have a closer look here.
> We don't have new insights regarding this, so we still are pretty sure
> that it shouldn't be a problem.
Ok, worth a try then.
> Xtext "just" provides textual syntax including IDE support for existing
> ecore models. So the parser creates an EMF model which can than further
> be used for anything.
> Eclipse Modeling provides a vast number of different languages and
> solutions to process EMF models. One is OCL another is M2T Xpand, which
> Xtext itself uses for code generation.
So, can xtext use an existing EMF model, or does it always have to
create one.
> There are two different ways of "acting on models".
> Code generation: Can be done e.g with Xpand
> Interpretation : Usually done with Java (use the Switch class EMF
> generates for you) as well as OCL, Xpand'x expression language, etc.
>
> Xtext itself does not provide a specific solution, as there are
> solutions available.
I'll need to look into Xpand, as I am not familiar with it.
>
> regards,
> Sven
|
|
|
Re: Newbie - EMF/ANTLR or xtext? [message #31629 is a reply to message #31564] |
Thu, 12 March 2009 07:14  |
Eclipse User |
|
|
|
Christophe Bouhier schrieb:
>> Xtext "just" provides textual syntax including IDE support for
>> existing ecore models. So the parser creates an EMF model which can
>> than further be used for anything.
>> Eclipse Modeling provides a vast number of different languages and
>> solutions to process EMF models. One is OCL another is M2T Xpand,
>> which Xtext itself uses for code generation.
>
> So, can xtext use an existing EMF model, or does it always have to
> create one.
>
>
Yes, one can use any number of existing EMF models in a grammar.
We have some languages in our test suite showing how it basically works.
Of course, the documentation will cover it as well.
regards,
Sven
|
|
|
Goto Forum:
Current Time: Fri Apr 25 19:42:52 EDT 2025
Powered by FUDForum. Page generated in 0.07556 seconds
|