Simon Van Mierlo e94b5905ef initial commit 8 years ago
..
csharp_runtime e94b5905ef initial commit 8 years ago
csharp_sccd_compiler e94b5905ef initial commit 8 years ago
csharp_tests e94b5905ef initial commit 8 years ago
javascript_runtime e94b5905ef initial commit 8 years ago
python_runtime e94b5905ef initial commit 8 years ago
python_sccd_compiler e94b5905ef initial commit 8 years ago
tanks e94b5905ef initial commit 8 years ago
test_files e94b5905ef initial commit 8 years ago
textualnotations e94b5905ef initial commit 8 years ago
unity_editor e94b5905ef initial commit 8 years ago
LICENSE e94b5905ef initial commit 8 years ago
README.md e94b5905ef initial commit 8 years ago
bouncing.html e94b5905ef initial commit 8 years ago
bouncing_balls.js e94b5905ef initial commit 8 years ago
bouncing_balls.js.xml e94b5905ef initial commit 8 years ago
bouncing_balls_backup.js e94b5905ef initial commit 8 years ago
javascript_fixed.zip e94b5905ef initial commit 8 years ago
javascript_models.zip e94b5905ef initial commit 8 years ago
particle_interaction.html e94b5905ef initial commit 8 years ago
particle_interaction_vis_js.js e94b5905ef initial commit 8 years ago
particle_interaction_vis_js.xml e94b5905ef initial commit 8 years ago
particle_interaction_vis_js_instrumented.xml e94b5905ef initial commit 8 years ago
schema.xml e94b5905ef initial commit 8 years ago

README.md

This is a fork of https://github.com/gl3nn/sccd_compiler

Statecharts and Class Diagram Compiler

Usage

Manual for the compiler written in Python :

$python sccdc.py --help
usage: sccdc.py [-h] [-o OUTPUT] [-v VERBOSE] [-p PROTOCOL] [-l LANGUAGE]
                input

positional arguments:
  input                 The path to the XML file to be compiled.

optional arguments:
  -h, --help            show this help message and exit
  -o OUTPUT, --output OUTPUT
                        The path to the generated code. Defaults to the same
                        name as the input file but with matching extension.
  -v VERBOSE, --verbose VERBOSE
                        2 = all output; 1 = only warnings and errors; 0 = only
                        errors; -1 = no output. Defaults to 2.
  -p PLATFORM, --platform PLATFORM
                        Let the compiled code run on top of threads or
                        gameloop. The default is threads.
  -l LANGUAGE, --language LANGUAGE
                        Target language, "csharp", "python" or "javascript". Defaults
                        to "python".

For a detailed explanation on the formalism's syntax please consult the latest report here.

Tests

Executing the tests written for the Python compiler and generated Python code can be done by running tests.py. This file imports the test cases from the test_files folder.

Tanks Example

In the tanks folder a tanks game can be found for which both the input handling of the player-controlled tank, and the behaviour of the NPC tank are modelled using the SCCD formalism. For this specific example the commands to compile the models are as follows :

python sccdc.py tanks/player_controller.xml -o tanks/player_controller.py -p gameloop
python sccdc.py tanks/ai_controller.xml -o tanks/ai_controller.py -p gameloop

The resulting files player_controller.py and ai_controller.py (and any other compiled code) depend on the runtime files found in python_runtime, so this folder should either be put in PYTHONPATH or directly in the tanks directory (you can use a symbolic link).

Live demo

Live demo of a statechart (compiled to Javascript) simulating a bouncing ball: https://gwd.dyn.mk/public/sccd/svgdemo