|Deriving model from binary class files [message #1821381]
||Wed, 12 February 2020 08:40
| Mirko Raner
Registered: July 2009
Location: New York City, NY
I've been working on a JVM-based programming language for a while. The language is somewhat similar to Java, but has some extensions and some restrictions compared to plain Java. Notably, due to some of the extensions, the source code cannot generally be translated to Java source code, and there is a compiler back end that directly produces JVM bytecode from the AST/domain model.|
Now, in addition to the primary source files, I want to incorporate pre-compiled libraries, just like one would include additional JARs on the class path (in fact, the libraries are just that, plain JARs). To compile source code against these JARs I somehow need to infer, at least partially, the domain model and AST based on the content of the JAR. I basically need classes and method signatures (no method implementations), so that the scope provider can resolve cross-references to elements that are defined in the library.
For some reason, I'm having a hard time finding existing examples of this kind of mechanism in other Xtext languages. I already have a simple implementation of IJvmModelInferrer, but since I'd like to infer domain elements (not JVM types) this does not seem the right spot for what I'm trying to do. IResourceServiceProvider and its related interfaces (e.g., IResourceDescription.Manager) seem more promising, but I can't quite put all the pieces together.
I am also wondering if I'm not making all this too complicated, and there is already some brilliantly simple mechanism to facilitate what I'm trying to do (as there often is with Xtext and EMF :-) )
Long story short: what is the recommended or standard mechanism to generate models/ASTs for binary libraries (that don't come with sources) so that they can be linked with another model that is generated from source?
Powered by FUDForum
. Page generated in 0.02052 seconds