/mittelwerk

A simple compiler to create automata for the Orbiter simulator.

Primary LanguageC++MIT LicenseMIT

The Mittelwerk Compiler

This is a group project for the 3info from the INSA-Rennes.

Our goal is to provide a tool chain for the Orbiter Space Flight Simulator, allowing us to write basic automata without technical knowledge.

STATUS

Currently, the compiler is made for and support only one ship, the ShuttleA.

TODO (Ordered by importance)

  • Tool to automagically paste the generated code into the vessel

  • More api functions

  • Compiler errors management

    • Type verification for expression and function call
    • Void does not have returns statements.
    • No state has been defined.
  • And some warning

    • When two or more state got the START/FINAL token
    • Trying to gotogoto when in the FINAL state.
  • Refactor

    • Extrn declaration at the beginning of file, to use function in the vessel code, not in the api
      • It would allow us to change more easily the ship
    • Use of a beautifier third party script
      • This way, we will not have to manage the code indentation, etc.
  • Suppress the visual studio requirement

  • Generate a nice Mittelwerk.jar

Grammar

TODO See the example.mw

Requirements

Mittelwerk Compiler

Orbiter compilation

  • Visual Studio (we use the 2013 pro version)
  • Orbiter 2010 sdk (currently in the git repository)

Howto

Recompile the compiler

  • Mv into the grammar directory
  • ant grammar

  • ant compile

Compile an automata

  • Write your automata in a file, for example, t800.mw
  • java -cp class Core.Mittelwerk t800.mw <optional_output.cpp> <optional_output.h>

  • <optional_output.cpp> contains the code of the automata, in a separate file.
  • <optional_output.h> contains the code that must be pasted in the vessel header.

Recompile the Ship dll

We suppose the code is generated in Otto.cpp and header.h.

  • Open the ship project with Visual Studio
  • Add the Otto.cpp file into it
  • Find the clbkPostStep function into the ship code (ShuttleA.cpp)
    • Add the following line at the beginning of it
    • postStep(simt, simdt, mjd);
  • Go into the ship header (ShuttleA.h), into the private section.
    • Paste the content of header.h into it.