Bloeckchengrafik / harpy

A fast and compilable way to write python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

πŸ¦… The Harpy Python Compiler

Harpy: A new fast and compilable pythonic scripting language

πŸ“– Table of Contents

πŸ“š Introduction

Harpy is a new fast and compilable way to write python code. It is a python to C++ compiler that can compile python code to a binary that can be executed without the need of a python interpreter.

It is using the python ast module to parse the python code and then compile it to the AST. The AST is then cross compiled to C++ and finally compiled to a binary. This makes it possible to compile python code to a binary that can be executed without the need of a python interpreter. Also, this form of python works on embedded systems that do not have the capability to run a full python interpreter.

This project is still in development and is not ready for production use.

πŸ–₯️ Installation

Since Harpy is still in development, it is not available on PyPI. To install Harpy, you need to clone the repository and use python3 -m harpy in the current working directory to run it.

πŸ–ŠοΈ Usage

If you just want to test it, install just and run just all in the root directory of the repository. This will run the tests and compile the example code found in the test_data directory.

Write a python script and compile it to a binary using

python3 -m harpy -i <file>.py 

This will create a binary file named a.out in the current working directory. You can run this binary using native commands. If you want to run it directly, you can use the -r flag.

python3 -m harpy -i <file>.py -r

You can also modify the behaviour of the compiler by using the following flags:

  • -i or --input: The input file
  • -c or --compiler: The compiler to use. Defaults to g++
  • -o or --output: The output file. Defaults to a.out
  • -r or --run: Run the program after compiling. Defaults to False
  • -p or --platform: Set the runtime platform. Defaults to cpp_std. This is the only platform available at the moment.

πŸ§‘ Contributing

I'd love to have your helping hand on Harpy! If you have any questions, feel free to open an issue. If you want to contribute, just submit a pull request.

πŸ’Ό License

Harpy is licensed under the MIT license. See the LICENSE file for more information.

About

A fast and compilable way to write python

License:MIT License


Languages

Language:Python 95.7%Language:C++ 2.3%Language:Just 1.4%Language:C 0.6%