Code Monkey home page Code Monkey logo

esir-tp-fsm-dsl-compiler-interpreter's Introduction

FSM (Finite State Machine) Domain Specific Metamodel, Language and Compiler to Java

by Léo Rolland and Valentin Lorand

Context

Based on lectures of Pr. Benoit Combemale (view academic personal page) and labs with Gwendal Jouneaux.

View tutorial on Github

Plutot que d’utiliser une librairie d'exécution d'un FSM dans un langage généraliste, on va proposer directement un langage spécifique. Exprimer la solution à notre problème dans les termes de l’espace de notre problème permet notamment de minimiser la complexité accidentelle liée au choix de langage/outils, de communiquer, de réfléchir, dans les termes du problème.

Dans l'ingénierie des modèles : un modèle est une abstraction de la réalité : pas la seule possible. Chacune des préoccupation est adressée par un modèle particulier. Quitte à les séparer, autant utiliser des outils adéquats pour chaque préoccupation, avec des langages spécifiques, des outils et méthodes.

Le méta méta modèle ECore permet de créer un métamodèle permetant de modéliser tous les FSM possibles

  • Ecore : méta méta modèle
  • FSM system (modelisé avec Ecore) : méta modèle (une instance du méta méta modèle)
  • Un FSM en particulier (décrit par une syntaxe concrete) : Modèle, (une instance du méta modèle)

XText permet de définir une grammaire qui sera interpretée en AST (Abstract Syntax Tree) d'éléments Ecore par un lexer, puis un parseur (Fournis par Xtext).

Notre compilateur (backend) parcours l'AST selon le design pattern Visiteur et génère un code Java exécutable qui permet d'exécuter notre FSM de manière intéractive.

Getting started

Requirements

  • Java 11
  • Eclipse Gemoc Studio (website)

Build the project and run the eclipse DSL App

  1. Clone the repository (workspace)
  2. Open Gemoc Studio and open the workspace
  3. Open fsm.genmodel (in fr.leorolland.fsm.model)
  4. Right click on FSM > Generate all
  5. Comment line to only run the java compiler (not the interpreter) JavaCompiler.xtend#L25
  6. Right click on GenerateFsmDsl.mwe2 (in org.xtext.example.fsmdsl > src > mysql) > Run as > MWE2 Workflow
  7. Right click on org.xtext.example.fsmdsl.ide > Run as > Eclipse Application
  8. Create a project
  9. Create a example.fsm with the following content
  10. Save
  11. View and execute in src-codegen

esir-tp-fsm-dsl-compiler-interpreter's People

Contributors

leorolland avatar valentinlorand avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.