Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Simplified include
Simplified include [message #1266642] Fri, 07 March 2014 19:17 Go to next message
Sergio Otero is currently offline Sergio OteroFriend
Messages: 39
Registered: June 2012
Member
Hi

I know it's been talked another time about the difficulty of doing c-like includes, but i cannot find the thread after a lot of time searching ...

Anyway, my question is about a simplified include with this specifications:

* The included file can reference things visible in the program that does the include
* The included file can be fully parsed by itself, but not linked (because of the references)
* The program that does the include cannot reference anything inside the included file
* The program that does the include could be fully parsed, linked and compiled without the include
* No need to provide incremental compilation, accurate error line information, etc. Only include the translation of the included file in the context used

Example as if Java where the parsed language (not the intended use):

PROGRAM1:
  int i = 0;
  INCLUDE "INCLUDED"
  System.out.println("PROGRAM1 "+i);

PROGRAM2:
  String i = "str";
  INCLUDE "INCLUDED"
  System.out.println("PROGRAM2 "+i);

INCLUDED:
System.out.println("INCLUDED "+i);

Could anyone please provide some firsts steps to try to implements this requirement?

Thanks

Sergio
Re: Simplified include [message #1271074 is a reply to message #1266642] Fri, 14 March 2014 07:23 Go to previous messageGo to next message
Sergio Otero is currently offline Sergio OteroFriend
Messages: 39
Registered: June 2012
Member
Any hints, please?
Re: Simplified include [message #1271087 is a reply to message #1271074] Fri, 14 March 2014 08:10 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

the question i on what level you want to get that solved.
i think it is a bad idea to have such includes and it maybe tons of work to get it runnings as you want todo it. (depending on how fancy the solution should be)
is this a legacy language? if not you may intoduce a component concept or a function concept and simply call resuable components and functions
instead of a include (c-like)

maybe you can store the root as element (in the Hello World example "model") of the included file under its resource name in the xtext index (by adapting the nameprovider)
but you would have to care about consitency checks and generation or whatever you want todo yourself


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Loading XText resources in eclipse plugin does not resolve proxies
Next Topic:Validating string list items under a parent object.
Goto Forum:
  


Current Time: Tue Apr 23 11:28:01 GMT 2024

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

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

Back to the top