Skip to content

Latest commit

 

History

History
39 lines (31 loc) · 1.42 KB

README.md

File metadata and controls

39 lines (31 loc) · 1.42 KB

Python Version

rusthon is a minimalist transpilation tool that converts a subset of the Python language to Rust. Designed to help developers grasp the basic concepts of transpilation, Rusthon provides a direct translation of common Python constructs to their Rust counterparts.

Feature

Currently, Rusthon supports the transpilation of the following constructs:

  • Functions with typed arguments and a typed return.
  • Basic arithmetic operations (+, -, *, /).
  • Function calls.
  • Variable assignments.
  • The conditional declaration if name == "main":.
  • The print() function.
  • For loop and range()
  • Class definitions
    • using types is better: def __init__(self, name: str, age: int)

How to Use

  1. Clone the repository:
git clone https://github.com/urso-ai/rusthon.git
cd rusthon
  1. Place your Python code in the test_sample.py file.
  2. Run main.py:
python main.py
  1. The resulting Rust code will be diplayed on the standard output.

Limitations

Rusthon is a teaching tool designed to transpile a specific subset of Python. As such, many Python language constructs, such as loops, classes, and exception handling, are not yet supported. Contributions to expand functionality are welcome!

Contributing

If you'd like to contribute to the project, feel free to fork and send a pull request. Any feedback or suggestions are appreciated!

License

MIT