Skip to main content

A Python to Mandarin Chinese transpiler.

Project description

🐼 RedPanda Transpiler

RedPanda Transpiler logo

A Python → Mandarin Chinese transpiler.

RedPanda is an experimental transpiler that converts standard Python syntax into readable Mandarin Chinese syntax while preserving the program's structure. It is designed for educational purposes, language learning, and experimentation with localized programming syntax.

Project Status: 🚧 Alpha (v0.1.0)


Features

  • Translate Python keywords into Mandarin Chinese
  • Translate built-in functions
  • Translate Python constants
  • Simple command-line interface
  • Lightweight with no external dependencies
  • Compatible with Python 3.11+

Example

Python

print("Hello, World!")

if True:
    print(len([1, 2, 3]))

for i in range(5):
    print(i)

Output

打印("Hello, World!")

如果 :
    打印(长度([1, 2, 3]))

对于 i  范围(5):
    打印(i)

Installation

Install RedPanda Transpiler from PyPI:

pip install redpanda-transpiler

Usage

Transpile a file:

redpanda-tr input.py

Write the output to another file:

redpanda-tr input.py -o output.py

Project Structure

RedPanda-transpiler/
│
├── redpanda/
│   ├── cli.py
│   ├── loader.py
│   ├── transpiler.py
│   ├── __main__.py
│   ├── __init__.py
│   └── data/
│       ├── keywords.json
│       ├── builtins.json
│       └── constants.json
│
├── pyproject.toml
├── README.md
├── LICENSE
└── setup.py

Supported Translations

Keywords

Python Mandarin
if 如果
else 否则
elif 否则如果
for 对于
while
def 定义
class
return 返回
import 导入
from
as 作为
try 尝试
except 异常
finally 最后

Built-ins

Python Mandarin
print 打印
input 输入
len 长度
range 范围
list 列表
dict 字典
tuple 元组
set 集合

Constants

Python Mandarin
True
False
None

Roadmap

  • Command-line interface
  • Keyword translation
  • Built-in translation
  • Constant translation
  • Tokenizer-based transpiler
  • AST-based transpiler
  • Reverse transpiler (Mandarin → Python)
  • Comment translation
  • Docstring translation
  • F-string support
  • Package import translation
  • Comprehensive unit tests
  • CI/CD with GitHub Actions

License

This project is licensed under the Apache License 2.0.

See the LICENSE file for details.


Disclaimer

RedPanda is an experimental project intended for education and research. The generated Mandarin syntax is not executable by the standard Python interpreter. It must be converted back to standard Python or interpreted by a compatible tool.


Author

fmasterpro27

GitHub: https://github.com/Fmasterpro27


If you find this project useful, consider giving it a ⭐ on GitHub!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

redpanda_transpiler-0.1.0.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

redpanda_transpiler-0.1.0-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file redpanda_transpiler-0.1.0.tar.gz.

File metadata

  • Download URL: redpanda_transpiler-0.1.0.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for redpanda_transpiler-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8cb7881aee69db8c065de952ba2564935b60286eb82e3ed54b924def853a39c9
MD5 50481b245ef86c1ddee3f45b99f58330
BLAKE2b-256 2fdb57afa008bfb3691c34c41073e91c1794cb20f20d49c171eec9eb019f9b75

See more details on using hashes here.

File details

Details for the file redpanda_transpiler-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for redpanda_transpiler-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ad7043621dfccb2760b5fcb26ef15cd0eaed43700b0900abd1bd858293c4ab70
MD5 02eda1ac5364e08d41d2a24c29af3d98
BLAKE2b-256 b13e6f6c98d03bb248f09d2cf151d892e9495887899c2f872d4904ac224154a6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page