cantonese 1.0.11__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cantonese-1.0.11/.github/workflows/CI.yml +169 -0
- cantonese-1.0.11/.gitignore +75 -0
- cantonese-1.0.11/CONTRIBUTING.md +41 -0
- cantonese-1.0.11/Cargo.lock +632 -0
- cantonese-1.0.11/Cargo.toml +25 -0
- cantonese-1.0.11/LICENSE +21 -0
- cantonese-1.0.11/PKG-INFO +578 -0
- cantonese-1.0.11/README-en.md +356 -0
- cantonese-1.0.11/README.md +547 -0
- cantonese-1.0.11/doc/cantonese.md +6 -0
- cantonese-1.0.11/doc/res.md +7 -0
- cantonese-1.0.11/doc//345/277/253/351/200/237/345/205/245/351/226/200_/345/273/243/346/235/261/350/251/261/347/211/210.md +1 -0
- cantonese-1.0.11/doc//345/277/253/351/200/237/345/205/245/351/226/200_/346/231/256/351/200/232/350/251/261/347/211/210.md +88 -0
- cantonese-1.0.11/examples/App/button_app.cantonese +22 -0
- cantonese-1.0.11/examples/App/helloworld_app.cantonese +11 -0
- cantonese-1.0.11/examples/Web/img.cantonese +10 -0
- cantonese-1.0.11/examples/Web/img.html +14 -0
- cantonese-1.0.11/examples/Web/script.cantonese +11 -0
- cantonese-1.0.11/examples/Web/style.cantonese +8 -0
- cantonese-1.0.11/examples/Web/style.html +12 -0
- cantonese-1.0.11/examples/Web/web_hello.cantonese +4 -0
- cantonese-1.0.11/examples/Web/web_hello.html +7 -0
- cantonese-1.0.11/examples/algorithms/Tower_of_Hanoi.cantonese +16 -0
- cantonese-1.0.11/examples/algorithms/binary_search.cantonese +26 -0
- cantonese-1.0.11/examples/algorithms/bubble_sort.cantonese +20 -0
- cantonese-1.0.11/examples/algorithms/factorial.cantonese +15 -0
- cantonese-1.0.11/examples/algorithms/fib.cantonese +16 -0
- cantonese-1.0.11/examples/algorithms/fizzbuzz.cantonese +19 -0
- cantonese-1.0.11/examples/algorithms/insert_sort.cantonese +19 -0
- cantonese-1.0.11/examples/algorithms/linear_search.cantonese +17 -0
- cantonese-1.0.11/examples/algorithms/max.cantonese +12 -0
- cantonese-1.0.11/examples/basic/HelloWorld.cantonese +2 -0
- cantonese-1.0.11/examples/basic/assert.cantonese +6 -0
- cantonese-1.0.11/examples/basic/assign.cantonese +8 -0
- cantonese-1.0.11/examples/basic/call_python.cantonese +6 -0
- cantonese-1.0.11/examples/basic/class.cantonese +23 -0
- cantonese-1.0.11/examples/basic/comment.cantonese +7 -0
- cantonese-1.0.11/examples/basic/exit.cantonese +8 -0
- cantonese-1.0.11/examples/basic/for.cantonese +11 -0
- cantonese-1.0.11/examples/basic/function.cantonese +14 -0
- cantonese-1.0.11/examples/basic/if.cantonese +20 -0
- cantonese-1.0.11/examples/basic/import.cantonese +8 -0
- cantonese-1.0.11/examples/basic/input.cantonese +4 -0
- cantonese-1.0.11/examples/basic/lambda.cantonese +6 -0
- cantonese-1.0.11/examples/basic/list.cantonese +13 -0
- cantonese-1.0.11/examples/basic/match.cantonese +9 -0
- cantonese-1.0.11/examples/basic/pipe.cantonese +4 -0
- cantonese-1.0.11/examples/basic/raise.cantonese +4 -0
- cantonese-1.0.11/examples/basic/set.cantonese +2 -0
- cantonese-1.0.11/examples/basic/try_finally.cantonese +15 -0
- cantonese-1.0.11/examples/basic/type.cantonese +4 -0
- cantonese-1.0.11/examples/basic/while.cantonese +16 -0
- cantonese-1.0.11/examples/functional/guard.cantonese +8 -0
- cantonese-1.0.11/examples/functional/reverse.cantonese +6 -0
- cantonese-1.0.11/examples/games/ball.cantonese +25 -0
- cantonese-1.0.11/examples/games/ball.gif +0 -0
- cantonese-1.0.11/examples/games/game.cantonese +111 -0
- cantonese-1.0.11/examples/games/snake.cantonese +141 -0
- cantonese-1.0.11/examples/leetcode/README.md +7 -0
- cantonese-1.0.11/examples/leetcode/climbStairs.cantonese +33 -0
- cantonese-1.0.11/examples/leetcode/getSum.cantonese +26 -0
- cantonese-1.0.11/examples/leetcode/minCount.cantonese +31 -0
- cantonese-1.0.11/examples/leetcode/numIdenticalPairs.cantonese +32 -0
- cantonese-1.0.11/examples/leetcode/rotateString.cantonese +31 -0
- cantonese-1.0.11/examples/leetcode/singleNumber.cantonese +22 -0
- cantonese-1.0.11/examples/lib_sample/csv_parse.cantonese +11 -0
- cantonese-1.0.11/examples/lib_sample/email.cantonese +11 -0
- cantonese-1.0.11/examples/lib_sample/file.cantonese +9 -0
- cantonese-1.0.11/examples/lib_sample/movies.xml +33 -0
- cantonese-1.0.11/examples/lib_sample/random.cantonese +7 -0
- cantonese-1.0.11/examples/lib_sample/re.cantonese +4 -0
- cantonese-1.0.11/examples/lib_sample/sleep.cantonese +6 -0
- cantonese-1.0.11/examples/lib_sample/stack.cantonese +7 -0
- cantonese-1.0.11/examples/lib_sample/students.csv +5 -0
- cantonese-1.0.11/examples/lib_sample/time.cantonese +7 -0
- cantonese-1.0.11/examples/lib_sample/translate.cantonese +18 -0
- cantonese-1.0.11/examples/lib_sample/turtle_sample.cantonese +14 -0
- cantonese-1.0.11/examples/lib_sample/ui.cantonese +11 -0
- cantonese-1.0.11/examples/lib_sample/url_request.cantonese +27 -0
- cantonese-1.0.11/examples/lib_sample/xml_parse.cantonese +23 -0
- cantonese-1.0.11/examples/machine_learning/KNN.cantonese +10 -0
- cantonese-1.0.11/examples/machine_learning/linear_regression.cantonese +9 -0
- cantonese-1.0.11/examples/machine_learning/math.cantonese +14 -0
- cantonese-1.0.11/examples/macros/eval.cantonese +18 -0
- cantonese-1.0.11/examples/macros/hello.cantonese +7 -0
- cantonese-1.0.11/examples/macros/max.cantonese +18 -0
- cantonese-1.0.11/examples/macros/vec.cantonese +11 -0
- cantonese-1.0.11/examples/numerical/Matrix.cantonese +11 -0
- cantonese-1.0.11/examples/numerical/calc_corr.cantonese +8 -0
- cantonese-1.0.11/examples/numerical/math.cantonese +14 -0
- cantonese-1.0.11/examples/sql/select.cantonese +7 -0
- cantonese-1.0.11/grammar/cantonese.bnf +138 -0
- cantonese-1.0.11/img/HelloApp.jpg +0 -0
- cantonese-1.0.11/img/game_result.jpg +0 -0
- cantonese-1.0.11/img/logo.jpg +0 -0
- cantonese-1.0.11/img/turtle_etc.jpg +0 -0
- cantonese-1.0.11/img/web_result.jpg +0 -0
- cantonese-1.0.11/pyproject.toml +50 -0
- cantonese-1.0.11/python/cantonese_rs/__init__.py +40 -0
- cantonese-1.0.11/python/cantonese_rs/cantonese.py +293 -0
- cantonese-1.0.11/python/cantonese_rs/error_mapper.py +75 -0
- cantonese-1.0.11/python/cantonese_rs/import_hook.py +126 -0
- cantonese-1.0.11/python/cantonese_rs/libs/__init__.py +133 -0
- cantonese-1.0.11/python/cantonese_rs/libs/lib_globals.py +22 -0
- cantonese-1.0.11/python/cantonese_rs/libs/std/__init__.py +1 -0
- cantonese-1.0.11/python/cantonese_rs/libs/std/app/impl.py +45 -0
- cantonese-1.0.11/python/cantonese_rs/libs/std/csv/impl.py +19 -0
- cantonese-1.0.11/python/cantonese_rs/libs/std/game/impl.py +230 -0
- cantonese-1.0.11/python/cantonese_rs/libs/std/gui/impl.py +11 -0
- cantonese-1.0.11/python/cantonese_rs/libs/std/https/impl.py +53 -0
- cantonese-1.0.11/python/cantonese_rs/libs/std/impl.py +344 -0
- cantonese-1.0.11/python/cantonese_rs/libs/std/json/impl.py +15 -0
- cantonese-1.0.11/src/ast/mod.rs +724 -0
- cantonese-1.0.11/src/compile_time/mod.rs +126 -0
- cantonese-1.0.11/src/compiler/mod.rs +711 -0
- cantonese-1.0.11/src/lexer/keywords.rs +128 -0
- cantonese-1.0.11/src/lexer/mod.rs +510 -0
- cantonese-1.0.11/src/lexer/span.rs +34 -0
- cantonese-1.0.11/src/lexer/token.rs +112 -0
- cantonese-1.0.11/src/lib.rs +12 -0
- cantonese-1.0.11/src/macros/mod.rs +614 -0
- cantonese-1.0.11/src/main.rs +72 -0
- cantonese-1.0.11/src/parser/exp.rs +817 -0
- cantonese-1.0.11/src/parser/macro_body.rs +80 -0
- cantonese-1.0.11/src/parser/macro_pat.rs +101 -0
- cantonese-1.0.11/src/parser/mod.rs +346 -0
- cantonese-1.0.11/src/parser/names.rs +93 -0
- cantonese-1.0.11/src/parser/stat.rs +806 -0
- cantonese-1.0.11/src/python_api.rs +306 -0
- cantonese-1.0.11/src/ui/diagnostic.rs +303 -0
- cantonese-1.0.11/src/ui/mod.rs +1 -0
- cantonese-1.0.11/test.py +138 -0
- cantonese-1.0.11/tests/unit/parse_examples.rs +280 -0
- cantonese-1.0.11/tests/unit/test.py +23 -0
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
# This file is autogenerated by maturin v1.7.0
|
|
2
|
+
# To update, run
|
|
3
|
+
#
|
|
4
|
+
# maturin generate-ci github
|
|
5
|
+
#
|
|
6
|
+
name: CI
|
|
7
|
+
|
|
8
|
+
on:
|
|
9
|
+
push:
|
|
10
|
+
branches:
|
|
11
|
+
- main
|
|
12
|
+
- master
|
|
13
|
+
tags:
|
|
14
|
+
- '*'
|
|
15
|
+
pull_request:
|
|
16
|
+
workflow_dispatch:
|
|
17
|
+
|
|
18
|
+
permissions:
|
|
19
|
+
contents: read
|
|
20
|
+
|
|
21
|
+
jobs:
|
|
22
|
+
linux:
|
|
23
|
+
runs-on: ${{ matrix.platform.runner }}
|
|
24
|
+
strategy:
|
|
25
|
+
matrix:
|
|
26
|
+
platform:
|
|
27
|
+
- runner: ubuntu-latest
|
|
28
|
+
target: x86_64
|
|
29
|
+
- runner: ubuntu-latest
|
|
30
|
+
target: x86
|
|
31
|
+
- runner: ubuntu-latest
|
|
32
|
+
target: aarch64
|
|
33
|
+
- runner: ubuntu-latest
|
|
34
|
+
target: armv7
|
|
35
|
+
- runner: ubuntu-latest
|
|
36
|
+
target: s390x
|
|
37
|
+
- runner: ubuntu-latest
|
|
38
|
+
target: ppc64le
|
|
39
|
+
steps:
|
|
40
|
+
- uses: actions/checkout@v4
|
|
41
|
+
- uses: actions/setup-python@v5
|
|
42
|
+
with:
|
|
43
|
+
python-version: 3.x
|
|
44
|
+
- name: Build wheels
|
|
45
|
+
uses: PyO3/maturin-action@v1
|
|
46
|
+
with:
|
|
47
|
+
target: ${{ matrix.platform.target }}
|
|
48
|
+
args: --release --out dist
|
|
49
|
+
sccache: 'true'
|
|
50
|
+
manylinux: auto
|
|
51
|
+
- name: Upload wheels
|
|
52
|
+
uses: actions/upload-artifact@v4
|
|
53
|
+
with:
|
|
54
|
+
name: wheels-linux-${{ matrix.platform.target }}
|
|
55
|
+
path: dist
|
|
56
|
+
|
|
57
|
+
musllinux:
|
|
58
|
+
runs-on: ${{ matrix.platform.runner }}
|
|
59
|
+
strategy:
|
|
60
|
+
matrix:
|
|
61
|
+
platform:
|
|
62
|
+
- runner: ubuntu-latest
|
|
63
|
+
target: x86_64
|
|
64
|
+
- runner: ubuntu-latest
|
|
65
|
+
target: x86
|
|
66
|
+
- runner: ubuntu-latest
|
|
67
|
+
target: aarch64
|
|
68
|
+
- runner: ubuntu-latest
|
|
69
|
+
target: armv7
|
|
70
|
+
steps:
|
|
71
|
+
- uses: actions/checkout@v4
|
|
72
|
+
- uses: actions/setup-python@v5
|
|
73
|
+
with:
|
|
74
|
+
python-version: 3.x
|
|
75
|
+
- name: Build wheels
|
|
76
|
+
uses: PyO3/maturin-action@v1
|
|
77
|
+
with:
|
|
78
|
+
target: ${{ matrix.platform.target }}
|
|
79
|
+
args: --release --out dist
|
|
80
|
+
sccache: 'true'
|
|
81
|
+
manylinux: musllinux_1_2
|
|
82
|
+
- name: Upload wheels
|
|
83
|
+
uses: actions/upload-artifact@v4
|
|
84
|
+
with:
|
|
85
|
+
name: wheels-musllinux-${{ matrix.platform.target }}
|
|
86
|
+
path: dist
|
|
87
|
+
|
|
88
|
+
windows:
|
|
89
|
+
runs-on: ${{ matrix.platform.runner }}
|
|
90
|
+
strategy:
|
|
91
|
+
matrix:
|
|
92
|
+
platform:
|
|
93
|
+
- runner: windows-latest
|
|
94
|
+
target: x64
|
|
95
|
+
- runner: windows-latest
|
|
96
|
+
target: x86
|
|
97
|
+
steps:
|
|
98
|
+
- uses: actions/checkout@v4
|
|
99
|
+
- uses: actions/setup-python@v5
|
|
100
|
+
with:
|
|
101
|
+
python-version: 3.x
|
|
102
|
+
architecture: ${{ matrix.platform.target }}
|
|
103
|
+
- name: Build wheels
|
|
104
|
+
uses: PyO3/maturin-action@v1
|
|
105
|
+
with:
|
|
106
|
+
target: ${{ matrix.platform.target }}
|
|
107
|
+
args: --release --out dist
|
|
108
|
+
sccache: 'true'
|
|
109
|
+
- name: Upload wheels
|
|
110
|
+
uses: actions/upload-artifact@v4
|
|
111
|
+
with:
|
|
112
|
+
name: wheels-windows-${{ matrix.platform.target }}
|
|
113
|
+
path: dist
|
|
114
|
+
|
|
115
|
+
macos:
|
|
116
|
+
runs-on: ${{ matrix.platform.runner }}
|
|
117
|
+
strategy:
|
|
118
|
+
matrix:
|
|
119
|
+
platform:
|
|
120
|
+
- runner: macos-latest
|
|
121
|
+
target: x86_64
|
|
122
|
+
- runner: macos-14
|
|
123
|
+
target: aarch64
|
|
124
|
+
steps:
|
|
125
|
+
- uses: actions/checkout@v4
|
|
126
|
+
- uses: actions/setup-python@v5
|
|
127
|
+
with:
|
|
128
|
+
python-version: 3.x
|
|
129
|
+
- name: Build wheels
|
|
130
|
+
uses: PyO3/maturin-action@v1
|
|
131
|
+
with:
|
|
132
|
+
target: ${{ matrix.platform.target }}
|
|
133
|
+
args: --release --out dist
|
|
134
|
+
sccache: 'true'
|
|
135
|
+
- name: Upload wheels
|
|
136
|
+
uses: actions/upload-artifact@v4
|
|
137
|
+
with:
|
|
138
|
+
name: wheels-macos-${{ matrix.platform.target }}
|
|
139
|
+
path: dist
|
|
140
|
+
|
|
141
|
+
sdist:
|
|
142
|
+
runs-on: ubuntu-latest
|
|
143
|
+
steps:
|
|
144
|
+
- uses: actions/checkout@v4
|
|
145
|
+
- name: Build sdist
|
|
146
|
+
uses: PyO3/maturin-action@v1
|
|
147
|
+
with:
|
|
148
|
+
command: sdist
|
|
149
|
+
args: --out dist
|
|
150
|
+
- name: Upload sdist
|
|
151
|
+
uses: actions/upload-artifact@v4
|
|
152
|
+
with:
|
|
153
|
+
name: wheels-sdist
|
|
154
|
+
path: dist
|
|
155
|
+
|
|
156
|
+
release:
|
|
157
|
+
name: Release
|
|
158
|
+
runs-on: ubuntu-latest
|
|
159
|
+
if: "startsWith(github.ref, 'refs/tags/')"
|
|
160
|
+
needs: [linux, musllinux, windows, macos, sdist]
|
|
161
|
+
steps:
|
|
162
|
+
- uses: actions/download-artifact@v4
|
|
163
|
+
- name: Publish to PyPI
|
|
164
|
+
uses: PyO3/maturin-action@v1
|
|
165
|
+
env:
|
|
166
|
+
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
|
|
167
|
+
with:
|
|
168
|
+
command: upload
|
|
169
|
+
args: --non-interactive --skip-existing wheels-*/*
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# For my test
|
|
2
|
+
test/test_c.s
|
|
3
|
+
test/test.c
|
|
4
|
+
test/a.exe
|
|
5
|
+
test/test.s
|
|
6
|
+
# ---> Python
|
|
7
|
+
# Byte-compiled / optimized / DLL files
|
|
8
|
+
__pycache__/
|
|
9
|
+
*.py[cod]
|
|
10
|
+
*$py.class
|
|
11
|
+
|
|
12
|
+
# C extensions
|
|
13
|
+
*.so
|
|
14
|
+
|
|
15
|
+
# Distribution / packaging
|
|
16
|
+
.Python
|
|
17
|
+
env/
|
|
18
|
+
build/
|
|
19
|
+
develop-eggs/
|
|
20
|
+
dist/
|
|
21
|
+
.venv/
|
|
22
|
+
downloads/
|
|
23
|
+
eggs/
|
|
24
|
+
.eggs/
|
|
25
|
+
lib/
|
|
26
|
+
lib64/
|
|
27
|
+
parts/
|
|
28
|
+
sdist/
|
|
29
|
+
var/
|
|
30
|
+
*.egg-info/
|
|
31
|
+
.installed.cfg
|
|
32
|
+
*.egg
|
|
33
|
+
|
|
34
|
+
# PyInstaller
|
|
35
|
+
# Usually these files are written by a python script from a template
|
|
36
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
37
|
+
*.manifest
|
|
38
|
+
*.spec
|
|
39
|
+
|
|
40
|
+
# Installer logs
|
|
41
|
+
pip-log.txt
|
|
42
|
+
pip-delete-this-directory.txt
|
|
43
|
+
|
|
44
|
+
# Unit test / coverage reports
|
|
45
|
+
htmlcov/
|
|
46
|
+
.tox/
|
|
47
|
+
.coverage
|
|
48
|
+
.coverage.*
|
|
49
|
+
.cache
|
|
50
|
+
nosetests.xml
|
|
51
|
+
coverage.xml
|
|
52
|
+
*,cover
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
|
|
61
|
+
# Sphinx documentation
|
|
62
|
+
docs/_build/
|
|
63
|
+
|
|
64
|
+
# PyBuilder
|
|
65
|
+
target/
|
|
66
|
+
|
|
67
|
+
*local_settings.py
|
|
68
|
+
.idea/*
|
|
69
|
+
media/*
|
|
70
|
+
|
|
71
|
+
# Vscode
|
|
72
|
+
.vscode/
|
|
73
|
+
|
|
74
|
+
*.exe
|
|
75
|
+
*.pdb
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
粵語編程語言鼓勵來自各路程序員嘅貢獻!
|
|
2
|
+
# 代碼貢獻指示與準則
|
|
3
|
+
1. Fork該項目 並克隆
|
|
4
|
+
```sh
|
|
5
|
+
git clone https://github.com/StepfenShawn/Cantonese
|
|
6
|
+
```
|
|
7
|
+
2. 創建 Feature 分支
|
|
8
|
+
```sh
|
|
9
|
+
$ git checkout -b AmazingFeature
|
|
10
|
+
```
|
|
11
|
+
3. 提交改動
|
|
12
|
+
```sh
|
|
13
|
+
$ git commit -m "Add some Amazing Features"
|
|
14
|
+
```
|
|
15
|
+
4. Push 分支
|
|
16
|
+
```sh
|
|
17
|
+
$ git push origin AmazingFeature
|
|
18
|
+
```
|
|
19
|
+
5. Pull Request
|
|
20
|
+
6. 請簡單說明該 PR 在哪方面進行了改進,最好解釋點解寫這個 PR
|
|
21
|
+
|
|
22
|
+
We really encourage you to contribute to the Cantonese programming language!
|
|
23
|
+
# Instructions to Contribute to **Cantonese** Project
|
|
24
|
+
1. Fork the repo:
|
|
25
|
+
```sh
|
|
26
|
+
git clone https://github.com/StepfenShawn/Cantonese
|
|
27
|
+
```
|
|
28
|
+
2. Create your Feature Branch
|
|
29
|
+
```sh
|
|
30
|
+
$ git checkout -b AmazingFeature
|
|
31
|
+
```
|
|
32
|
+
3. Commit your Changes
|
|
33
|
+
```sh
|
|
34
|
+
$ git commit -m "Add some Amazing Features"
|
|
35
|
+
```
|
|
36
|
+
4. Push to the Branch
|
|
37
|
+
```sh
|
|
38
|
+
$ git push origin AmazingFeature
|
|
39
|
+
```
|
|
40
|
+
5. Open a Pull Request
|
|
41
|
+
6. Please briefly demonstrate what changes this PR made, and better explain why you made this PR
|