Giter Club home page Giter Club logo

dragon's Introduction

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).

dragon's People

Contributors

nightblade9 avatar

Watchers

 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.