Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » General purpose language possible
General purpose language possible [message #856097] Wed, 25 April 2012 11:16 Go to next message
Stefan Langenmaier is currently offline Stefan LangenmaierFriend
Messages: 9
Registered: April 2012
Junior Member
First of all I'm completely new to XText. I've read through the tutorials and toyed around with them in my installation.

My actual goal is to get some syntax coloring for ObjectiveC files. So I thought why not do this properly. I found a grammar for ObjectiveC here:

www.antlr.org/grammar/1212699960054/ObjectiveC2ansi.g

And used ANTLRworks to make the grammar "backtracking free":

gist.github.com/2488942

Then I added in eclipse a new XText project and used the following as my grammar file:

gist.github.com/2488959

Now my problems and questions:
Whenever I make a change to this file a "XText validation" job starts that never finishes. Can I turn this off somehow?

Whenever I run the mwe2 file it starts until it comes to the point "Validating resources" and does not continue. Has this something to do with my aforementioned problem?

Is XText suited at all for general purpose languages? Is this grammar too big, too complex? Is it feasible at all and should I read on? Is there a simpler way for syntax coloring? What would you recommend? Of course features like code completion would be nice in the future but are not necessary now.

Sorry for the links I'm not allowed to use them before I have 25 posts.
Re: General purpose language possible [message #856297 is a reply to message #856097] Wed, 25 April 2012 14:39 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi Stefan,

your grammar does not look like a proper Xtext grammar, e.g. something
like fragment ABC is not valid syntax. I bet the validation crashes
somewhere because of too many errors. The same happens with the mwe2
workflow. Did you try to increase the memory for your Eclipse instance?

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 25.04.12 13:16, schrieb Stefan Langenmaier:
> First of all I'm completely new to XText. I've read through the
> tutorials and toyed around with them in my installation.
>
> My actual goal is to get some syntax coloring for ObjectiveC files. So I
> thought why not do this properly. I found a grammar for ObjectiveC here:
>
> www.antlr.org/grammar/1212699960054/ObjectiveC2ansi.g
>
> And used ANTLRworks to make the grammar "backtracking free":
>
> gist.github.com/2488942
>
> Then I added in eclipse a new XText project and used the following as my
> grammar file:
>
> gist.github.com/2488959
>
> Now my problems and questions:
> Whenever I make a change to this file a "XText validation" job starts
> that never finishes. Can I turn this off somehow?
>
> Whenever I run the mwe2 file it starts until it comes to the point
> "Validating resources" and does not continue. Has this something to do
> with my aforementioned problem?
>
> Is XText suited at all for general purpose languages? Is this grammar
> too big, too complex? Is it feasible at all and should I read on? Is
> there a simpler way for syntax coloring? What would you recommend? Of
> course features like code completion would be nice in the future but are
> not necessary now.
>
> Sorry for the links I'm not allowed to use them before I have 25 posts.
Re: General purpose language possible [message #856327 is a reply to message #856097] Wed, 25 April 2012 15:08 Go to previous messageGo to next message
Henrik Lindberg is currently offline Henrik LindbergFriend
Messages: 2509
Registered: July 2009
Senior Member
A warning is in place - Objective C (like all C dialects) have #include
and #define macros which makes it quite difficult to support correctly -
there is no built in support for such (very complex) features in Xtext.
(You can search for earlier discussions on that topic in this forum).

Just wanted to warn you before you go to far down on you path only to
realize how difficult it is to support those features.

e.g.
#include popes.h
#define whenever if

whenever(CURRENT_POPE.hasAFunnyHat()) {
....
}

- henrik

On 2012-25-04 13:16, Stefan Langenmaier wrote:
> First of all I'm completely new to XText. I've read through the
> tutorials and toyed around with them in my installation.
>
> My actual goal is to get some syntax coloring for ObjectiveC files. So I
> thought why not do this properly. I found a grammar for ObjectiveC here:
>
> www.antlr.org/grammar/1212699960054/ObjectiveC2ansi.g
>
> And used ANTLRworks to make the grammar "backtracking free":
>
> gist.github.com/2488942
>
> Then I added in eclipse a new XText project and used the following as my
> grammar file:
>
> gist.github.com/2488959
>
> Now my problems and questions:
> Whenever I make a change to this file a "XText validation" job starts
> that never finishes. Can I turn this off somehow?
>
> Whenever I run the mwe2 file it starts until it comes to the point
> "Validating resources" and does not continue. Has this something to do
> with my aforementioned problem?
>
> Is XText suited at all for general purpose languages? Is this grammar
> too big, too complex? Is it feasible at all and should I read on? Is
> there a simpler way for syntax coloring? What would you recommend? Of
> course features like code completion would be nice in the future but are
> not necessary now.
>
> Sorry for the links I'm not allowed to use them before I have 25 posts.
Re: General purpose language possible [message #856380 is a reply to message #856297] Wed, 25 April 2012 16:00 Go to previous messageGo to next message
Stefan Langenmaier is currently offline Stefan LangenmaierFriend
Messages: 9
Registered: April 2012
Junior Member
Thanks for the hint with the fragments. I will try to remove them tomorrow and write back if this changes something.

With regard to the memory the task manager shows no extraordinary usage. Eclipse uses 250-300MB RAM. What would be an appropriate amount for this? What amount should I set for eclipse if this is important?
Re: General purpose language possible [message #856454 is a reply to message #856380] Wed, 25 April 2012 17:20 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi Stefan,

if you don't experience any slowdown, the HEAP size should be ok. How
much perm gen space do you allow for Eclipse? 128m should be sufficient
here for 64bit systems.

You should have seen error markers for the fragment part. The syntax
would be terminal fragment FRAGMENT_NAME.. which brings me to the fact
that you seem to introduce a bunch of terminal rules but you did not use
the correct syntax. I'd recommend to have a look at some tutorials and
simpler languages before you start to work on a bigger thing like
ObjectiveC.

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 25.04.12 18:00, schrieb Stefan Langenmaier:
> Thanks for the hint with the fragments. I will try to remove them
> tomorrow and write back if this changes something.
>
> With regard to the memory the task manager shows no extraordinary usage.
> Eclipse uses 250-300MB RAM. What would be an appropriate amount for
> this? What amount should I set for eclipse if this is important?
Re: General purpose language possible [message #857043 is a reply to message #856327] Thu, 26 April 2012 07:42 Go to previous messageGo to next message
Stefan Langenmaier is currently offline Stefan LangenmaierFriend
Messages: 9
Registered: April 2012
Junior Member
@Henrik:

I saw your warning already a couple of times in the forum and on blogs but I probably didn't realize until now how much this complicates the whole process.

So thanks for the warning.
Re: General purpose language possible [message #857087 is a reply to message #856454] Thu, 26 April 2012 08:29 Go to previous message
Stefan Langenmaier is currently offline Stefan LangenmaierFriend
Messages: 9
Registered: April 2012
Junior Member
Hi Sebastian,

at least in my development instance of eclipse I haven't got any perm gen space errors. For the development instance I haven't changed the default settings and there the eclipse.ini says "--launcher.XXMaxPermSize 256m"

I edited the grammar file with the eclipse text editor. When I open the file with the eclipse XText editor the file is displayed with syntax highlighting and the outline is generated properly. I can see no error markers. With the "fragment"s and without them.

As soon as I change something in the file the "XText Validation" starts and never finishes and also cannot be canceled.

I'm also pretty sure that I have to investigate XText a little bit more before I can do this. Smile

Nevertheless I'm currently just evaluating this option. Maybe someone has an idea how-to do syntax coloring (even if it's without XText). Rolling Eyes
Previous Topic:[SOLVED] Grammar Warning The rule ... may be consumed without object instantiation.
Next Topic:Conditional expression with xtext
Goto Forum:
  


Current Time: Fri Mar 29 13:56:57 GMT 2024

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

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

Back to the top