Skip to content
Dragon is a universal Python translater.
Python GAP Haxe Batchfile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
dragon Hint for future architecture Feb 23, 2018
tests
.gitignore Remove .gitignore settings related to Mars Jan 18, 2018
.travis.yml Travis: run tests! Jan 2, 2018
README.md Update README.md Feb 22, 2018
requirements.txt Refactor tests: use nose to parameterize Jan 17, 2018
run_tests.bat Added some template creator tests Jan 2, 2018

README.md

Dragon

Build status

Dragon transpiles Python 3 code to Haxe, which can then be transpiled and compiled to various platforms and languages (C++, Javascript, Java, C#, Ruby, Python, Lua, etc. for browser/web, desktop, Android, iOS, etc.)

Usage

  • Create some Python code
  • Create a file like compiler.py
  • Add the import from dragon.transpiler.python_to_haxe_transpiler import PythonToHaxeTranspiler
  • Invoke PythonToHaxeTranspiler(source_path, files).transpile() passing in the directory root of the source files (important for package names!) and a list of files to transpile (eg. os.glob.glob("**/*.py"))).
  • Check the outputted Haxe code. Invoke the Haxe compiler as usual.

For constructs that don't exist in Python (eg. override, @:...), add them to your Python code and prefix them with @haxe:.

Caveats

  • When importing Haxe code, use the Haxe-style from package.subpackage import ClassName
  • Make sure all Python files have a final empty line

Limitations

Dragon was created in order to be able to write HaxeFlixel games in Python. Python supports complex features (eg. generator functions, decorators) and ships with a vast collection of functionality (eg. itertools, decimal, etc.); it would be impossible to keep Dragon up to date.

Instead, Dragon supports just enough functionality to build games. If you find your favourite feature or module missing, feel free to open an issue or send us a PR.

Roadmap

Currently, Dragon is in a very early stage of development. We're using Lark to generate the parse tree, and then generate the resulting Haxe code.

Our roadmap:

  • Transpile the default HaxeFlixel "hello world" template (v0.1)
  • Transpile a more complicated HaxeFlixel template
  • Transpile an actual HaxeFlixel game

Once we achieve these goals, we plan to release the v1.0.0 version of Dragon.

You may also be interested in Mars, our companion project which handles generating, compiling, and running Python-based HaxeFlixel projects (via Dragon).

You can’t perform that action at this time.