Skip to main content
taishan

toisan-lang

pytest Code style: black PyPI - License PyPI - Python Version PyPI - Wheel Downloads GitHub Pages

A programming language based on Toisanese, aka Taishanese, a dialect of Cantonese

Install

pip install toisan-lang

Command Line Usage

  • python -m toisan_lang "..." to transpile and execute toisan-lang in Python
  • --show xxx to show extra information if given: tree for parse tree, code for transpiled python code

For example,

Transpile and execute

python -m toisan_lang "你系嚿叉烧。你个头系假咯。睇下你系乜呀。睇下(丐时)系乜。"

Output:

{'头': False}
2020-02-28 12:09:01.580252
To Show extra information
python -m toisan_lang "你系嚿叉烧。你个头系假咯。睇下你系乜呀。睇下(丐时)系乜。" --show tree code

Output:


Parse Tree:
(START
  (begin_program (begin_scope))
  (block
    (statement (st_assign
      (var_list (var (variable_ref '你'))) '系'
      (exp_list (exp (dict_init '嚿叉烧'))))) '。'
    (statement (st_assign
      (var_list (var (variable_ref '你' '个' '头'))) '系'
      (exp_list (exp (constant (boolean '假')))))) '咯' '。'
    (statement (st_print '睇下'
      (var (variable_ref '你')) '系乜')) '呀' '。'
    (statement (st_print '睇下'
      (adjusted_exp '('
        (exp (now '丐时')) ')') '系乜')) '。')
  (end_program (end_scope)))

Transpiled Python Code:
from datetime import datetime

def main():
    你 = dict()
    你['头'] = False
    print( 你 )
    print( ( datetime.now() ) )

if __name__ == '__main__':
    main()

{'头': False}
2020-03-03 22:26:13.549966

Code Usage

from toisan_lang import parse
program = """
...
"""
code, tree = parse(program)
print(code)
print(tree)
exec(code)

Develop

git clone https://github.com/zehengl/toisan-lang.git
cd toisan-lang
python -m venv .venv
source .venv/bin/activate
pip install -r requirements-dev.txt

To run test, simply

pytest

Happy hacking!

Credits

Metadata

Release files for toisan-lang 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for toisan-lang 0.1.4
File Size Uploaded Provenance Actions
toisan-lang-0.1.4.tar.gz 40.7 kB Without provenance Details for toisan-lang-0.1.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for toisan-lang 0.1.4
File Interpreter ABI Platform Actions
toisan_lang-0.1.4-py3-none-any.whl Python 3 none any Details for toisan_lang-0.1.4-py3-none-any.whl

Total release size: 49.3 kB

Release files / toisan-lang-0.1.4.tar.gz

Download URL toisan-lang-0.1.4.tar.gz
Size 40.7 kB
Tags Source
SHA-256 checksum
How to use checksums
9be889e36680c87dcfde979b0bae83c93a849c0034283c86d50241ea081b4d5e
BLAKE2b-256 checksum
How to use checksums
67067bdb100606e6c077ce198399e336c22dd8a4627afdf059e671fd9b9a1c03
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.13

Release files / toisan_lang-0.1.4-py3-none-any.whl

Download URL toisan_lang-0.1.4-py3-none-any.whl
Size 8.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3f81866f04b12841369edef040b497fd72b9d52f1fdcf785483f6de6a6d70a04
BLAKE2b-256 checksum
How to use checksums
383ab4587064a06993da9b0de99ec5d502988020e013ff441c0220094d61cd88
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.13

Security for toisan-lang 0.1.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page