Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot make Melange work on a MiniJava language #97

Open
ebousse opened this issue Nov 8, 2017 · 3 comments
Open

Cannot make Melange work on a MiniJava language #97

ebousse opened this issue Nov 8, 2017 · 3 comments
Assignees

Comments

@ebousse
Copy link
Contributor

ebousse commented Nov 8, 2017

I feel bad for opening an issue for a very unprecise and not well identified problem, but here I go...

I am working on a MiniJava language, available here: https://github.com/tetrabox/minijava

Most importantly, it contains:

  • org.tetrabox.minijava.xtext: a grammar-first xtext project, which generates the abstract syntax
  • org.tetrabox.minijava.semantics.modelstate: an additional metamodel that defines the execution state of a minijava program
  • org.tetrabox.minijava.semantics: semantics written only with K3 aspects (no new classes, no static classes)
  • org.tetrabox.minijava.dsl: the melange project, with the following melange file:
package org.tetrabox.minijava

 external language MiniJava { 
	syntax "platform:/resource/org.tetrabox.minijava.xtext/model/generated/MiniJava.ecore"
}

language XMiniJava inherits MiniJava {
	
	syntax "platform:/resource/org.tetrabox.minijava.semantics.modelstate/model/MiniJavaDynamicData.ecore" renaming {
		"minijavadynamicdata" to "miniJava"
	}
	with  org.tetrabox.minijava.semantics.* 
}

When starting "Generate All" on the melange file, no error message appears, but several problems occur:

  • sometimes, the code generated from the metamodel of the generated language runtime has errors
  • sometimes, the metamodel of the generated language runtime has errors
  • always: most of the code that should be generated in org.tetrabox.minijava.dsl/src-gen is missing, eg. adapters, the classes that represent the languages and the model types, etc.

In the end, some projects have errors, and the melange file always have the warning "Cannot find EMF runtime for XMiniJava".

If anyone has any idea of what I am doing wrong, or of what Melange is doing wrong, or of any workaround that I could use, I would be extremely interested :(

@tdegueul tdegueul self-assigned this Nov 9, 2017
@ebousse
Copy link
Contributor Author

ebousse commented Nov 9, 2017

Also a quick note, the renaming is used as a workaround to two bugs that occur when no renaming is used to merge both packages into a single one:

  • sometimes the same EClass Symbol is generated twice in both packages of the language runtime (miniJava and minijavadynamicdata)
  • sometimes, the names of the generated Java factories are inverted in the packages of the language runtime (miniJava and minijavadynamicdata)

So in fact it would also be great to have this example work without the use of renaming.

@tdegueul
Copy link

"Works for me" :(. I can successfully generate everything (runtime language, adapters, interfaces, etc.).

I'm working outside GEMOC: Eclipse Modeling + latest Melange.

Could you please try to update to the latest version of Melange in your GEMOC installation and report back?

https://ci.inria.fr/k3al/job/melange-master/lastSuccessfulBuild/artifact/releng/fr.inria.diverse.melange.p2updatesite/target/site/.

@ebousse
Copy link
Contributor Author

ebousse commented Nov 13, 2017

OK, I confirm that is now works well with master, for some reason. Thanks all!

However, I still have several errors when I remove the renaming in the melange file, due to the Eclass Symbol being generated twice for some reason (one per EPackage).

Originally it only exists in the miniJava epackage, in the abstract syntax:
capture d ecran de 2017-11-13 14-19-08

But after running Generate All, it can be found in both resulting epackages:
capture d ecran de 2017-11-13 14-15-06

If you want I can create a separate issue for this problem, but it's up to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants