# iEcoreGen **Repository Path**: ustbmde/iecoregen ## Basic Information - **Project Name**: iEcoreGen - **Description**: No description available - **Primary Language**: Java - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-08-15 - **Last Updated**: 2026-02-27 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Introduction **iEcoreGen** is a LLM-enhanced model-driven code generation project. It combines conventional MDE code generation with LLM-based code generation. MDE allows to generate correct code from a model. However, MDE fails when the model cannot express our intention. In contrast, LLM-based code generation can always give a response, even though its answer may be incorrect. The basic idea of iEcoreGen is to combine MDE and LLM. Given an Ecore model, we ask EMF to generate source code from the model, while leaving unspecified operations to LLMs. We hope that such a combination can allow us to benifit from both MDE and LLM. # Approach ![Approach Workflow](docs/workflow.jpg) The input is an ecore model, optionally with a system requirement. Our tool will read the ecore model and check if there is a requirement. If not, our tool will ask LLMs to synthesize a requirement according to the model. Then, we ask LLMs to write a specification for every operation. An operation specification includes a summary of functionality, an algorithm, input and output values, and pre-/post-conditions. We will extract the specificaitons returned and store them as operation documents in the model. After than, EMF code generator will be invoked to generate Java code from the ecore model. Note that operations defined in the model are still unimplemented and the specifications will be generated as docstrings. We further send Java code generated by EMF to LLMs and ask them to complete unimplemented operations based on their docstrings. Due to token limit, we must minimize the Java code sent to LLMs by hiding details of Java methods and fields that are not intended to be completed by LLMs. We also provide necessary context, such as related classes and their methods, to facilitate code generation. At last, we merge the code returned by LLMs into the EMF generated code to complete the entire generation process. # Workflow iEcoreGen uses MWE2 to automate the entire workflow. Users need to create a MWE file to enable the generation. A simple MWE file looks like below. ``` module iecoregen.sample import org.eclipse.xtext.xtext.generator.* import org.eclipse.xtext.xtext.generator.model.project.* import edu.ustb.sei.mde.mwe2.* var rootPath = ".." Workflow { component = EcoreGenerator { configuration = { project = StandardProjectConfig { baseName = "" rootPath = rootPath createEclipseMetaData = true } code = { encoding = "UTF-8" lineDelimiter = "\r\n" fileHeader = "/*\n * generated by Enhanced EcoreGen\n */" preferXtendStubs = false } } language = EcoreLanguage { ecoreFile="" basePackage = "" fileExtensions = "" suppressInterfaces = true llmConfig = '/conf.properties' } languageModule = 'edu.ustb.sei.mde.eecg.llm.languageModule.DefaultEnhancedEcoreGenModule' } } ``` The workflow will read a properties file to load the parameters of LLMs. The properties file looks like below. ``` apikey= url=https://api.deepseek.com/ model=deepseek-chat ``` You can change `url` and `model`. We have only tested deepseek models.