GitHub: https://github.com/Model-Based-Design-Lab/cmlang
This repository contains the domain-specific-language tools related to [Computational Modeling]
This repository contains two Java/Xtext based projects.
src/info.computationalmodeling.lang.parent
Contains the Xtext language definitions of the following domain-specific languages of models of computation:
- Finite State Automata
- Regular Expressions
- Linear Temporal Logic
- Markov Chains
- Dataflow Graphs
- Max-plus Algebra Models
It further contains a server for the Language Server Protocol (LSP) through standard I/O to facilitate the use of editors that support LSP. (In particular the Monaco based web editor of the Computational Modeling Workbench).
src/info.computationalmodeling.lang.codegen
This project contains a code generation tool for the various languages defined in the LSP project.
Depending on the model it generates one more of the following
- Visualization using graphviz
- Conversion to the SDF3 file format
- Visualization in LaTeX
- Conversion to Octave
Extensions for the files are assumed to be as follows:
.sdffor dataflow models, generating Graphviz and SDF3.mpmfor max-plus models, generating LaTeX.fsafor finite state automata models, generating Graphviz.dtmcfor Markov Chain models, generating Octave and Graphviz.ltlfor Linear Temporal Logic models, generating LaTeX.regexfor regular expression models, generating LaTeX
The software can be built from the command line or using the provided docker image. Note that the build creates both Linux and Windows scripts to run the Java based tools.
Building from the command line requires a recent Java JDK and Maven to be installed.
cd src\info.computationalmodeling.lang.parent\
mvn installThe built language server, for Windows or Unix, respectively, can be found in:
src/info.computationalmodeling.lang.parent/info.computationalmodeling.lang.lsp/target/cm-lsp-1.0.0-SNAPSHOT-win.zip
src/info.computationalmodeling.lang.parent/info.computationalmodeling.lang.lsp/target/cm-lsp-1.0.0-SNAPSHOT-unix.zip
The built code generator can be found in:
src/info.computationalmodeling.lang.codegen.parent/info.computationalmodeling.lang.codegen/target/cm-codegen-1.0.0-SNAPSHOT-win.zip
src/info.computationalmodeling.lang.codegen.parent/info.computationalmodeling.lang.codegen/target/cm-codegen-1.0.0-SNAPSHOT-unix.zip
Build the docker image:
The Dockerfile is located in the /src directory.
In the /src directory, run the following command to build the image.
docker build -t cmlang .Run the docker image using a mounted volume referred to as <volume-name> in the command below.
docker run -v <volume-name>:/output cmlangAfter a successful run the results are in the mounted volume.
Note that the software requires a Java JRE to be installed on the host platform to run.
The LSP project produces a script to start the application in the bin directory after building. The script is called computational-modelling-language-server-stdio. When run, it accepts LSP clients on stdin and produces outputs on stdout.
The code generation project produces a script to start the application in the bin directory after building.
The tool is run with the following command-line.
codegen <input-file> <output-dir>
It will apply all code generation options it has for the type of input-file and writes corresponding output files in the directory output-dir.
This tool has been developed by the Model-Based Design Lab, https://computationalmodeling.info
GitHub: https://github.com/Model-Based-Design-Lab
Contact: Marc Geilen, [email protected]
This software is licensed under the MIT License