Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » C-Based Editor (Xtext or CDT)?
C-Based Editor (Xtext or CDT)? [message #844816] Sat, 14 April 2012 11:40 Go to next message
Oleg Bolshakov is currently offline Oleg BolshakovFriend
Messages: 36
Registered: August 2010
Member
Hello, I'm going to create an Eclipse editor of a language, based on C grammar. Are there any Xtext c grammars? What would you recommend - to create a new editor with Xtext or try to extend existing CDT grammar?

[Updated on: Sat, 14 April 2012 12:47]

Report message to a moderator

Re: C-Based Editor (Xtext or CDT)? [message #844883 is a reply to message #844816] Sat, 14 April 2012 13:19 Go to previous messageGo to next message
Andreas Graf is currently offline Andreas GrafFriend
Messages: 211
Registered: July 2009
Senior Member
Hi Oleg,

it depends on what you mean by "based on C grammar". Do you want to support #define and #include with C-like semantics? This would be one of the most important aspects. If you need to support cpp-like preprocessing: Try to find a different project Smile

Andreas
Re: C-Based Editor (Xtext or CDT)? [message #844911 is a reply to message #844883] Sat, 14 April 2012 14:05 Go to previous messageGo to next message
Oleg Bolshakov is currently offline Oleg BolshakovFriend
Messages: 36
Registered: August 2010
Member
Andreas Graf

it depends on what you mean by "based on C grammar".

I mean several extended concepts like tasks with their local variables, functions and С#-like events. But the code is C-like (all functions are C-like).

Andreas Graf

Do you want to support #define and #include with C-like semantics? This would be one of the most important aspects.

Why do you think so? Do you think there is difficulty in supporting #define and #include with Xtext grammar?

Andreas Graf

If you need to support cpp-like preprocessing: Try to find a different project Smile

Again, why? I know that Xtext supports linking and scoping, what did you mean?

[Updated on: Sat, 14 April 2012 14:14]

Report message to a moderator

Re: C-Based Editor (Xtext or CDT)? [message #844997 is a reply to message #844911] Sat, 14 April 2012 16:16 Go to previous message
tiange zhang is currently offline tiange zhangFriend
Messages: 16
Registered: February 2011
Location: Shanghai, China
Junior Member
Hi Oleg,
Supporting preprocessing is difficult for IDE. Java has no preprocessing support, C# has only limited support for preprocessing (h**p://msdn.microsoft.com/en-us/library/ed8yd1ha.aspx).

Considering the following dsl files:

a.dsl
print(a);
int b;


b.dsl
func(){
	int a;
	#include "a.dsl"
	print(b);

}


There are two source files. Xtext will try to resolve names referenced by each file and export names defined in each file, this is what linking and scoping try to do. In "a.dsl", Xtext can't resolve name 'a' and will failed to compile.

Preprocessor support can result in source fragments which are impossible for grammar to recognize.
Previous Topic:strange completion
Next Topic:Need some help
Goto Forum:
  


Current Time: Sat Apr 20 01:35:34 GMT 2024

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

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

Back to the top