A programming language based on Toisanese, aka Taishanese, a dialect of Cantonese
Project description
toisan-lang
A programming language based on Toisanese, aka Taishanese, a dialect of Cantonese
See demo at toisan-lang-demo.herokuapp.com
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
- logo from https://izihun.com/yishuzi/564471.html
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
toisan-lang-0.1.3.tar.gz
(39.4 kB
view hashes)
Built Distribution
Close
Hashes for toisan_lang-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f33ce67ff8ff7b697be8d3daa7c06219e84168d5cd8a32e2626ffc2fca5bf453 |
|
MD5 | 422c4ac2121350b870032914b5f78903 |
|
BLAKE2b-256 | 3d208bb492615fe345054d8d370a855431080531446eec5223cbb6d5b0f20be2 |