toisan-lang


Nametoisan-lang JSON
Version 0.1.4 PyPI version JSON
download
home_page
SummaryA programming language based on Toisanese, aka Taishanese, a dialect of Cantonese
upload_time2024-02-06 06:09:24
maintainer
docs_urlNone
author
requires_python>=3.8
license
keywords toisan taishan
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <div align="center">
    <img src="https://raw.githubusercontent.com/zehengl/toisan-lang/main/logo.jpg" alt="taishan" height="128">
</div>

# toisan-lang

[![pytest](https://github.com/zehengl/toisan-lang/actions/workflows/pytest.yml/badge.svg)](https://github.com/zehengl/toisan-lang/actions/workflows/pytest.yml)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)
![PyPI - License](https://img.shields.io/pypi/l/toisan-lang)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/toisan-lang)
![PyPI - Wheel](https://img.shields.io/pypi/wheel/toisan-lang)
[![Downloads](https://static.pepy.tech/badge/toisan-lang)](https://pepy.tech/project/toisan-lang)
[![GitHub Pages](https://github.com/zehengl/toisan-lang/actions/workflows/gh-deploy.yml/badge.svg)](https://github.com/zehengl/toisan-lang/actions/workflows/gh-deploy.yml)

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
```

<details>
<summary>To Show extra information</summary>

    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
```

</details>

## Code Usage

```python
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

- logo from https://izihun.com/yishuzi/564471.html

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "toisan-lang",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "Zeheng Li <imzehengl@gmail.com>",
    "keywords": "Toisan,Taishan",
    "author": "",
    "author_email": "Zeheng Li <imzehengl@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/67/06/7bdb100606e6c077ce198399e336c22dd8a4627afdf059e671fd9b9a1c03/toisan-lang-0.1.4.tar.gz",
    "platform": null,
    "description": "<div align=\"center\">\n    <img src=\"https://raw.githubusercontent.com/zehengl/toisan-lang/main/logo.jpg\" alt=\"taishan\" height=\"128\">\n</div>\n\n# toisan-lang\n\n[![pytest](https://github.com/zehengl/toisan-lang/actions/workflows/pytest.yml/badge.svg)](https://github.com/zehengl/toisan-lang/actions/workflows/pytest.yml)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)\n![PyPI - License](https://img.shields.io/pypi/l/toisan-lang)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/toisan-lang)\n![PyPI - Wheel](https://img.shields.io/pypi/wheel/toisan-lang)\n[![Downloads](https://static.pepy.tech/badge/toisan-lang)](https://pepy.tech/project/toisan-lang)\n[![GitHub Pages](https://github.com/zehengl/toisan-lang/actions/workflows/gh-deploy.yml/badge.svg)](https://github.com/zehengl/toisan-lang/actions/workflows/gh-deploy.yml)\n\nA programming language based on Toisanese, aka Taishanese, a dialect of Cantonese\n\n## Install\n\n    pip install toisan-lang\n\n## Command Line Usage\n\n- `python -m toisan_lang \"...\"` to transpile and execute toisan-lang in Python\n- `--show xxx` to show extra information if given: `tree` for parse tree, `code` for transpiled python code\n\nFor example,\n\n### Transpile and execute\n\n    python -m toisan_lang \"\u4f60\u7cfb\u56bf\u53c9\u70e7\u3002\u4f60\u4e2a\u5934\u7cfb\u5047\u54af\u3002\u7747\u4e0b\u4f60\u7cfb\u4e5c\u5440\u3002\u7747\u4e0b\uff08\u4e10\u65f6\uff09\u7cfb\u4e5c\u3002\"\n\nOutput:\n\n```\n{'\u5934': False}\n2020-02-28 12:09:01.580252\n```\n\n<details>\n<summary>To Show extra information</summary>\n\n    python -m toisan_lang \"\u4f60\u7cfb\u56bf\u53c9\u70e7\u3002\u4f60\u4e2a\u5934\u7cfb\u5047\u54af\u3002\u7747\u4e0b\u4f60\u7cfb\u4e5c\u5440\u3002\u7747\u4e0b\uff08\u4e10\u65f6\uff09\u7cfb\u4e5c\u3002\" --show tree code\n\nOutput:\n\n```\n\nParse Tree:\n(START\n  (begin_program (begin_scope))\n  (block\n    (statement (st_assign\n      (var_list (var (variable_ref '\u4f60'))) '\u7cfb'\n      (exp_list (exp (dict_init '\u56bf\u53c9\u70e7'))))) '\u3002'\n    (statement (st_assign\n      (var_list (var (variable_ref '\u4f60' '\u4e2a' '\u5934'))) '\u7cfb'\n      (exp_list (exp (constant (boolean '\u5047')))))) '\u54af' '\u3002'\n    (statement (st_print '\u7747\u4e0b'\n      (var (variable_ref '\u4f60')) '\u7cfb\u4e5c')) '\u5440' '\u3002'\n    (statement (st_print '\u7747\u4e0b'\n      (adjusted_exp '\uff08'\n        (exp (now '\u4e10\u65f6')) '\uff09') '\u7cfb\u4e5c')) '\u3002')\n  (end_program (end_scope)))\n\nTranspiled Python Code:\nfrom datetime import datetime\n\ndef main():\n    \u4f60 = dict()\n    \u4f60['\u5934'] = False\n    print( \u4f60 )\n    print( ( datetime.now() ) )\n\nif __name__ == '__main__':\n    main()\n\n{'\u5934': False}\n2020-03-03 22:26:13.549966\n```\n\n</details>\n\n## Code Usage\n\n```python\nfrom toisan_lang import parse\nprogram = \"\"\"\n...\n\"\"\"\ncode, tree = parse(program)\nprint(code)\nprint(tree)\nexec(code)\n```\n\n## Develop\n\n    git clone https://github.com/zehengl/toisan-lang.git\n    cd toisan-lang\n    python -m venv .venv\n    source .venv/bin/activate\n    pip install -r requirements-dev.txt\n\nTo run test, simply\n\n    pytest\n\nHappy hacking!\n\n## Credits\n\n- logo from https://izihun.com/yishuzi/564471.html\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "A programming language based on Toisanese, aka Taishanese, a dialect of Cantonese",
    "version": "0.1.4",
    "project_urls": {
        "homepage": "https://zehengl.github.io/toisan-lang/",
        "repository": "https://github.com/zehengl/toisan-lang"
    },
    "split_keywords": [
        "toisan",
        "taishan"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "383ab4587064a06993da9b0de99ec5d502988020e013ff441c0220094d61cd88",
                "md5": "a322d1d71f3cf8935bf23ca61049052f",
                "sha256": "3f81866f04b12841369edef040b497fd72b9d52f1fdcf785483f6de6a6d70a04"
            },
            "downloads": -1,
            "filename": "toisan_lang-0.1.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a322d1d71f3cf8935bf23ca61049052f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 8562,
            "upload_time": "2024-02-06T06:09:23",
            "upload_time_iso_8601": "2024-02-06T06:09:23.590840Z",
            "url": "https://files.pythonhosted.org/packages/38/3a/b4587064a06993da9b0de99ec5d502988020e013ff441c0220094d61cd88/toisan_lang-0.1.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "67067bdb100606e6c077ce198399e336c22dd8a4627afdf059e671fd9b9a1c03",
                "md5": "85332b5ee7f265dde372e03096464af8",
                "sha256": "9be889e36680c87dcfde979b0bae83c93a849c0034283c86d50241ea081b4d5e"
            },
            "downloads": -1,
            "filename": "toisan-lang-0.1.4.tar.gz",
            "has_sig": false,
            "md5_digest": "85332b5ee7f265dde372e03096464af8",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 40744,
            "upload_time": "2024-02-06T06:09:24",
            "upload_time_iso_8601": "2024-02-06T06:09:24.917899Z",
            "url": "https://files.pythonhosted.org/packages/67/06/7bdb100606e6c077ce198399e336c22dd8a4627afdf059e671fd9b9a1c03/toisan-lang-0.1.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-06 06:09:24",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "zehengl",
    "github_project": "toisan-lang",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "toisan-lang"
}
        
Elapsed time: 0.17783s