Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Generating DSL2 files from DSL1(DSL1 generates java files but also .dsl2 files (files recognized by DSL2). The problem is: .dsl2 files do not trigger code generation automatically)
icon14.gif  Generating DSL2 files from DSL1 [message #1731395] Wed, 04 May 2016 23:02 Go to next message
Miguel Jimenez is currently offline Miguel JimenezFriend
Messages: 40
Registered: July 2015
Member
Hello,

I developed two DSLs, DSL1 and DSL2. When DSL1 is installed, DSL2 is also installed. I solved this by requiring DSL2.dsl, DSL2.ide, and DSL2.ui in the DSL1's feature.xml, is that the right way of doing it? Each DSL has its own update site.

Now, DSL1 generates java files but also .dsl2 files (files recognized by DSL2). It does that in dsl1-gen directory.

The problem is that code generation is not automatically triggered for those files, so the java code from .dsl2 files is not generated in dsl2-gen. The .dsl2 files show errors because (I guess) Xbase uses the generated code to validate things.

Is this a common use case? What would be a possible way to solve this? Until now, the user needs to open each DSL2 derived file, modify it and save, so the java files can be generated.
Re: Generating DSL2 files from DSL1 [message #1731836 is a reply to message #1731395] Tue, 10 May 2016 12:26 Go to previous messageGo to next message
Jan Koehnlein is currently offline Jan KoehnleinFriend
Messages: 760
Registered: July 2009
Location: Hamburg
Senior Member
Xbase uses the inferred model for validation.

Is DSL2 using Xbase? Have you implemented a model inferrer?


---
Get professional support from the Xtext committers at www.typefox.io
Re: Generating DSL2 files from DSL1 [message #1731893 is a reply to message #1731836] Tue, 10 May 2016 16:56 Go to previous message
Miguel Jimenez is currently offline Miguel JimenezFriend
Messages: 40
Registered: July 2015
Member
Hi Jan,

Yes, both DSLs use XBase and they both implement a Model inferrer. Although DSL1 also uses a generator, to generate .dsl2 files.

Suppose these snippets correspond to the generated .dsl2 files:

package org.example
subsystem Server {
}


package org.example
depends on Server
subsystem Client {
}


When the user opens Client.dsl2, the editor shows an error in line 2 ("depends on Server") because Server is not recognized/validated/etc. When the user modify and save these files (for example, add an empty space), DSL2 generates the corresponding java classes in dsl2-gen, and everything works ok.

Is there a way to trigger this generation so the user does not have to do it manually?

[Updated on: Tue, 10 May 2016 16:57]

Report message to a moderator

Previous Topic:Seven languages in the website documentation
Next Topic:Handling older files which contain unescaped keywords
Goto Forum:
  


Current Time: Wed Sep 25 10:06:08 GMT 2024

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

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

Back to the top