koatl 0.1.42__tar.gz → 0.2.3__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.
- koatl-0.2.3/Cargo.lock +218 -0
- koatl-0.2.3/Cargo.toml +3 -0
- {koatl-0.1.42 → koatl-0.2.3}/PKG-INFO +1 -1
- {koatl-0.1.42 → koatl-0.2.3}/koatl/Cargo.toml +1 -1
- {koatl-0.1.42 → koatl-0.2.3/koatl}/python/koatl/cli.py +15 -1
- {koatl-0.1.42 → koatl-0.2.3/koatl}/python/koatl/std/alg/async.tl +1 -1
- {koatl-0.1.42 → koatl-0.2.3/koatl}/python/koatl/std/alg/do.tl +5 -5
- {koatl-0.1.42 → koatl-0.2.3}/koatl/python/koatl/std/alg/env.tl +3 -3
- {koatl-0.1.42 → koatl-0.2.3/koatl}/python/koatl/std/alg/memo.tl +7 -8
- {koatl-0.1.42 → koatl-0.2.3}/koatl/python/koatl/std/alg/result.tl +5 -5
- {koatl-0.1.42 → koatl-0.2.3}/koatl/python/koatl/std/data/list.tl +3 -3
- {koatl-0.1.42 → koatl-0.2.3}/koatl/python/koatl/std/iter.tl +6 -6
- {koatl-0.1.42 → koatl-0.2.3}/koatl/python/koatl/std/lazy_module.tl +1 -1
- {koatl-0.1.42 → koatl-0.2.3}/koatl/src/emit_py.rs +64 -13
- {koatl-0.1.42 → koatl-0.2.3}/koatl/tests/e2e/base/match.tl +27 -12
- koatl-0.2.3/koatl/tests/e2e/prelude/try.tl +28 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/tests/e2e/prelude/virtual.tl +2 -2
- koatl-0.2.3/koatl/tests/parse/matches.tl +2 -0
- koatl-0.2.3/koatl/tests/parse/numbers.tl +24 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl-core/Cargo.toml +1 -1
- {koatl-0.1.42/koatl-core/parser → koatl-0.2.3/koatl-core}/src/ast.rs +11 -62
- koatl-0.1.42/koatl-core/parser/src/util.rs → koatl-0.2.3/koatl-core/src/ast_builder.rs +14 -7
- {koatl-0.1.42 → koatl-0.2.3}/koatl-core/src/inference.rs +17 -21
- {koatl-0.1.42 → koatl-0.2.3}/koatl-core/src/lib.rs +34 -34
- koatl-0.2.3/koatl-core/src/lift_cst.rs +681 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl-core/src/main.rs +2 -2
- {koatl-0.1.42 → koatl-0.2.3}/koatl-core/src/parse_timer.rs +10 -11
- {koatl-0.1.42 → koatl-0.2.3}/koatl-core/src/py/ast.rs +33 -23
- koatl-0.1.42/koatl-core/src/py/util.rs → koatl-0.2.3/koatl-core/src/py/ast_builder.rs +21 -20
- {koatl-0.1.42 → koatl-0.2.3}/koatl-core/src/py/emit.rs +57 -34
- {koatl-0.1.42 → koatl-0.2.3}/koatl-core/src/py/mod.rs +1 -1
- {koatl-0.1.42 → koatl-0.2.3}/koatl-core/src/resolve_scopes.rs +31 -38
- {koatl-0.1.42 → koatl-0.2.3}/koatl-core/src/transform.rs +76 -45
- {koatl-0.1.42 → koatl-0.2.3}/koatl-core/src/util.rs +1 -1
- koatl-0.2.3/koatl-parser/Cargo.toml +6 -0
- koatl-0.2.3/koatl-parser/src/cst.rs +720 -0
- koatl-0.2.3/koatl-parser/src/lexer.rs +2024 -0
- koatl-0.2.3/koatl-parser/src/lib.rs +7 -0
- koatl-0.2.3/koatl-parser/src/parser.rs +2405 -0
- koatl-0.2.3/koatl-parser/src/simple_fmt.rs +743 -0
- {koatl-0.1.42/koatl → koatl-0.2.3}/python/koatl/cli.py +15 -1
- {koatl-0.1.42/koatl → koatl-0.2.3}/python/koatl/std/alg/async.tl +1 -1
- {koatl-0.1.42/koatl → koatl-0.2.3}/python/koatl/std/alg/do.tl +5 -5
- {koatl-0.1.42 → koatl-0.2.3}/python/koatl/std/alg/env.tl +3 -3
- {koatl-0.1.42/koatl → koatl-0.2.3}/python/koatl/std/alg/memo.tl +7 -8
- {koatl-0.1.42 → koatl-0.2.3}/python/koatl/std/alg/result.tl +5 -5
- {koatl-0.1.42 → koatl-0.2.3}/python/koatl/std/data/list.tl +3 -3
- {koatl-0.1.42 → koatl-0.2.3}/python/koatl/std/iter.tl +6 -6
- {koatl-0.1.42 → koatl-0.2.3}/python/koatl/std/lazy_module.tl +1 -1
- koatl-0.1.42/Cargo.lock +0 -438
- koatl-0.1.42/Cargo.toml +0 -3
- koatl-0.1.42/koatl/tests/e2e/prelude/try.tl +0 -29
- koatl-0.1.42/koatl/tests/parse/matches.tl +0 -2
- koatl-0.1.42/koatl-core/parser/Cargo.toml +0 -7
- koatl-0.1.42/koatl-core/parser/src/lexer.rs +0 -1106
- koatl-0.1.42/koatl-core/parser/src/lib.rs +0 -10
- koatl-0.1.42/koatl-core/parser/src/parser.rs +0 -1577
- koatl-0.1.42/koatl-core/src/parser.rs +0 -1
- {koatl-0.1.42 → koatl-0.2.3}/README.md +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/.github/workflows/CI.yml +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/.gitignore +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/LICENSE +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/README.md +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/python/koatl/__init__.py +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/python/koatl/__main__.py +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/python/koatl/notebook/__init__.py +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/python/koatl/notebook/magic.py +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/python/koatl/prelude/__init__.tl +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/python/koatl/runtime/__init__.py +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/python/koatl/runtime/meta_finder.py +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/python/koatl/runtime/record.py +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/python/koatl/runtime/vattr.py +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/python/koatl/std/alg/__init__.tl +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/python/koatl/std/alg/base.tl +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/python/koatl/std/data/__init__.tl +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/python/koatl/std/data/record.tl +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/python/koatl/std/ext.tl +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/python/koatl/std/io.tl +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/python/koatl/std/json.tl +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/python/koatl/std/pickle.tl +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/python/koatl/std/re.tl +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/python/koatl/std/trait.py +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/requirements.txt +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/src/lib.rs +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/tests/e2e/base/containers.tl +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/tests/e2e/base/data.txt +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/tests/e2e/base/decorators.tl +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/tests/e2e/base/destructure-for-and-fn.tl +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/tests/e2e/base/destructure.tl +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/tests/e2e/base/escape_ident.tl +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/tests/e2e/base/fstr.tl +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/tests/e2e/base/functions.tl +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/tests/e2e/base/generator.tl +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/tests/e2e/base/if_expr.tl +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/tests/e2e/base/loops.tl +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/tests/e2e/base/nary-list.tl +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/tests/e2e/base/placeholder.tl +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/tests/e2e/base/precedence.tl +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/tests/e2e/base/scopes.tl +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/tests/e2e/base/semantic_whitespace.tl +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/tests/e2e/base/short_circuit.tl +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/tests/e2e/base/with.tl +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/tests/e2e/prelude/async.tl +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/tests/e2e/prelude/aug_assign.tl +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/tests/e2e/prelude/coal.tl +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/tests/e2e/prelude/env.tl +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/tests/e2e/prelude/imports.tl +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/tests/e2e/prelude/iterables.tl +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/tests/e2e/prelude/list.tl +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/tests/e2e/prelude/memo.tl +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/tests/e2e/prelude/record.tl +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/tests/e2e/prelude/result.tl +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/tests/e2e/prelude/slice.tl +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/tests/e2e/util/__init__.py +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/tests/e2e/util/module0.tl +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/tests/e2e/util/module1.tl +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/tests/e2e/util/module2.tl +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/tests/parse/arith.tl +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/tests/parse/assign.tl +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/tests/parse/block-comments.tl +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/tests/parse/deco.tl +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/tests/parse/func.tl +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/tests/test_e2e.py +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl/tests/test_parse.py +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/koatl-core/src/types.rs +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/pyproject.toml +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/python/koatl/__init__.py +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/python/koatl/__main__.py +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/python/koatl/notebook/__init__.py +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/python/koatl/notebook/magic.py +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/python/koatl/prelude/__init__.tl +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/python/koatl/runtime/__init__.py +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/python/koatl/runtime/meta_finder.py +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/python/koatl/runtime/record.py +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/python/koatl/runtime/vattr.py +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/python/koatl/std/alg/__init__.tl +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/python/koatl/std/alg/base.tl +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/python/koatl/std/data/__init__.tl +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/python/koatl/std/data/record.tl +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/python/koatl/std/ext.tl +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/python/koatl/std/io.tl +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/python/koatl/std/json.tl +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/python/koatl/std/pickle.tl +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/python/koatl/std/re.tl +0 -0
- {koatl-0.1.42 → koatl-0.2.3}/python/koatl/std/trait.py +0 -0
koatl-0.2.3/Cargo.lock
ADDED
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
# This file is automatically @generated by Cargo.
|
|
2
|
+
# It is not intended for manual editing.
|
|
3
|
+
version = 4
|
|
4
|
+
|
|
5
|
+
[[package]]
|
|
6
|
+
name = "ariadne"
|
|
7
|
+
version = "0.5.1"
|
|
8
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
9
|
+
checksum = "36f5e3dca4e09a6f340a61a0e9c7b61e030c69fc27bf29d73218f7e5e3b7638f"
|
|
10
|
+
dependencies = [
|
|
11
|
+
"unicode-width",
|
|
12
|
+
"yansi",
|
|
13
|
+
]
|
|
14
|
+
|
|
15
|
+
[[package]]
|
|
16
|
+
name = "autocfg"
|
|
17
|
+
version = "1.5.0"
|
|
18
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
19
|
+
checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
|
|
20
|
+
|
|
21
|
+
[[package]]
|
|
22
|
+
name = "heck"
|
|
23
|
+
version = "0.5.0"
|
|
24
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
25
|
+
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
|
26
|
+
|
|
27
|
+
[[package]]
|
|
28
|
+
name = "indoc"
|
|
29
|
+
version = "2.0.6"
|
|
30
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
31
|
+
checksum = "f4c7245a08504955605670dbf141fceab975f15ca21570696aebe9d2e71576bd"
|
|
32
|
+
|
|
33
|
+
[[package]]
|
|
34
|
+
name = "koatl"
|
|
35
|
+
version = "0.2.3"
|
|
36
|
+
dependencies = [
|
|
37
|
+
"ariadne",
|
|
38
|
+
"koatl-core",
|
|
39
|
+
"once_cell",
|
|
40
|
+
"pyo3",
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
[[package]]
|
|
44
|
+
name = "koatl-core"
|
|
45
|
+
version = "0.1.0"
|
|
46
|
+
dependencies = [
|
|
47
|
+
"ariadne",
|
|
48
|
+
"koatl-parser",
|
|
49
|
+
"once_cell",
|
|
50
|
+
"slotmap",
|
|
51
|
+
]
|
|
52
|
+
|
|
53
|
+
[[package]]
|
|
54
|
+
name = "koatl-parser"
|
|
55
|
+
version = "0.1.0"
|
|
56
|
+
|
|
57
|
+
[[package]]
|
|
58
|
+
name = "libc"
|
|
59
|
+
version = "0.2.174"
|
|
60
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
61
|
+
checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776"
|
|
62
|
+
|
|
63
|
+
[[package]]
|
|
64
|
+
name = "memoffset"
|
|
65
|
+
version = "0.9.1"
|
|
66
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
67
|
+
checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a"
|
|
68
|
+
dependencies = [
|
|
69
|
+
"autocfg",
|
|
70
|
+
]
|
|
71
|
+
|
|
72
|
+
[[package]]
|
|
73
|
+
name = "once_cell"
|
|
74
|
+
version = "1.21.3"
|
|
75
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
76
|
+
checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
|
|
77
|
+
|
|
78
|
+
[[package]]
|
|
79
|
+
name = "portable-atomic"
|
|
80
|
+
version = "1.11.1"
|
|
81
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
82
|
+
checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483"
|
|
83
|
+
|
|
84
|
+
[[package]]
|
|
85
|
+
name = "proc-macro2"
|
|
86
|
+
version = "1.0.95"
|
|
87
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
88
|
+
checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778"
|
|
89
|
+
dependencies = [
|
|
90
|
+
"unicode-ident",
|
|
91
|
+
]
|
|
92
|
+
|
|
93
|
+
[[package]]
|
|
94
|
+
name = "pyo3"
|
|
95
|
+
version = "0.25.1"
|
|
96
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
97
|
+
checksum = "8970a78afe0628a3e3430376fc5fd76b6b45c4d43360ffd6cdd40bdde72b682a"
|
|
98
|
+
dependencies = [
|
|
99
|
+
"indoc",
|
|
100
|
+
"libc",
|
|
101
|
+
"memoffset",
|
|
102
|
+
"once_cell",
|
|
103
|
+
"portable-atomic",
|
|
104
|
+
"pyo3-build-config",
|
|
105
|
+
"pyo3-ffi",
|
|
106
|
+
"pyo3-macros",
|
|
107
|
+
"unindent",
|
|
108
|
+
]
|
|
109
|
+
|
|
110
|
+
[[package]]
|
|
111
|
+
name = "pyo3-build-config"
|
|
112
|
+
version = "0.25.1"
|
|
113
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
114
|
+
checksum = "458eb0c55e7ece017adeba38f2248ff3ac615e53660d7c71a238d7d2a01c7598"
|
|
115
|
+
dependencies = [
|
|
116
|
+
"once_cell",
|
|
117
|
+
"target-lexicon",
|
|
118
|
+
]
|
|
119
|
+
|
|
120
|
+
[[package]]
|
|
121
|
+
name = "pyo3-ffi"
|
|
122
|
+
version = "0.25.1"
|
|
123
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
124
|
+
checksum = "7114fe5457c61b276ab77c5055f206295b812608083644a5c5b2640c3102565c"
|
|
125
|
+
dependencies = [
|
|
126
|
+
"libc",
|
|
127
|
+
"pyo3-build-config",
|
|
128
|
+
]
|
|
129
|
+
|
|
130
|
+
[[package]]
|
|
131
|
+
name = "pyo3-macros"
|
|
132
|
+
version = "0.25.1"
|
|
133
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
134
|
+
checksum = "a8725c0a622b374d6cb051d11a0983786448f7785336139c3c94f5aa6bef7e50"
|
|
135
|
+
dependencies = [
|
|
136
|
+
"proc-macro2",
|
|
137
|
+
"pyo3-macros-backend",
|
|
138
|
+
"quote",
|
|
139
|
+
"syn",
|
|
140
|
+
]
|
|
141
|
+
|
|
142
|
+
[[package]]
|
|
143
|
+
name = "pyo3-macros-backend"
|
|
144
|
+
version = "0.25.1"
|
|
145
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
146
|
+
checksum = "4109984c22491085343c05b0dbc54ddc405c3cf7b4374fc533f5c3313a572ccc"
|
|
147
|
+
dependencies = [
|
|
148
|
+
"heck",
|
|
149
|
+
"proc-macro2",
|
|
150
|
+
"pyo3-build-config",
|
|
151
|
+
"quote",
|
|
152
|
+
"syn",
|
|
153
|
+
]
|
|
154
|
+
|
|
155
|
+
[[package]]
|
|
156
|
+
name = "quote"
|
|
157
|
+
version = "1.0.40"
|
|
158
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
159
|
+
checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d"
|
|
160
|
+
dependencies = [
|
|
161
|
+
"proc-macro2",
|
|
162
|
+
]
|
|
163
|
+
|
|
164
|
+
[[package]]
|
|
165
|
+
name = "slotmap"
|
|
166
|
+
version = "1.0.7"
|
|
167
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
168
|
+
checksum = "dbff4acf519f630b3a3ddcfaea6c06b42174d9a44bc70c620e9ed1649d58b82a"
|
|
169
|
+
dependencies = [
|
|
170
|
+
"version_check",
|
|
171
|
+
]
|
|
172
|
+
|
|
173
|
+
[[package]]
|
|
174
|
+
name = "syn"
|
|
175
|
+
version = "2.0.104"
|
|
176
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
177
|
+
checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40"
|
|
178
|
+
dependencies = [
|
|
179
|
+
"proc-macro2",
|
|
180
|
+
"quote",
|
|
181
|
+
"unicode-ident",
|
|
182
|
+
]
|
|
183
|
+
|
|
184
|
+
[[package]]
|
|
185
|
+
name = "target-lexicon"
|
|
186
|
+
version = "0.13.2"
|
|
187
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
188
|
+
checksum = "e502f78cdbb8ba4718f566c418c52bc729126ffd16baee5baa718cf25dd5a69a"
|
|
189
|
+
|
|
190
|
+
[[package]]
|
|
191
|
+
name = "unicode-ident"
|
|
192
|
+
version = "1.0.18"
|
|
193
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
194
|
+
checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"
|
|
195
|
+
|
|
196
|
+
[[package]]
|
|
197
|
+
name = "unicode-width"
|
|
198
|
+
version = "0.1.14"
|
|
199
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
200
|
+
checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af"
|
|
201
|
+
|
|
202
|
+
[[package]]
|
|
203
|
+
name = "unindent"
|
|
204
|
+
version = "0.2.4"
|
|
205
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
206
|
+
checksum = "7264e107f553ccae879d21fbea1d6724ac785e8c3bfc762137959b5802826ef3"
|
|
207
|
+
|
|
208
|
+
[[package]]
|
|
209
|
+
name = "version_check"
|
|
210
|
+
version = "0.9.5"
|
|
211
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
212
|
+
checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
|
|
213
|
+
|
|
214
|
+
[[package]]
|
|
215
|
+
name = "yansi"
|
|
216
|
+
version = "1.0.1"
|
|
217
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
218
|
+
checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049"
|
koatl-0.2.3/Cargo.toml
ADDED
|
@@ -9,9 +9,23 @@ def transpile_from_source(source, mode="script", script_path="<string>"):
|
|
|
9
9
|
|
|
10
10
|
def run_from_source(source, mode="script", script_path="<string>"):
|
|
11
11
|
from koatl import transpile
|
|
12
|
+
import ast
|
|
12
13
|
|
|
13
14
|
transpiled_code = transpile(source, mode=mode, filename=str(script_path))
|
|
14
|
-
|
|
15
|
+
|
|
16
|
+
try:
|
|
17
|
+
code_obj = compile(transpiled_code, script_path, "exec")
|
|
18
|
+
except Exception as e:
|
|
19
|
+
|
|
20
|
+
class Visitor(ast.NodeVisitor):
|
|
21
|
+
def generic_visit(self, node):
|
|
22
|
+
if hasattr(node, "lineno"):
|
|
23
|
+
if node.lineno > node.end_lineno:
|
|
24
|
+
print(f"Error: {node.lineno} > {node.end_lineno} for {node}")
|
|
25
|
+
super().generic_visit(node)
|
|
26
|
+
|
|
27
|
+
Visitor().visit(transpiled_code)
|
|
28
|
+
raise
|
|
15
29
|
|
|
16
30
|
script_globals = {"__name__": "__main__"}
|
|
17
31
|
|
|
@@ -31,7 +31,7 @@ export Async = class(MonadOnce):
|
|
|
31
31
|
self = gen.send(yield from self.__await__())
|
|
32
32
|
if not hasattr(self, "__await__"):
|
|
33
33
|
raise ValueError(f"Expected the binder to return an Awaitable, but got {type(self).__name__}")
|
|
34
|
-
except StopIteration(value=value)
|
|
34
|
+
except StopIteration(value=value) =>
|
|
35
35
|
return value
|
|
36
36
|
|
|
37
37
|
pure = staticmethod& x => Async.from_generator_fn& () =>
|
|
@@ -7,10 +7,10 @@ export do = f => wraps(f)& (*args, **kwargs) =>
|
|
|
7
7
|
let m
|
|
8
8
|
try:
|
|
9
9
|
m = gen.send(None)
|
|
10
|
-
except StopIteration() as e
|
|
10
|
+
except StopIteration() as e =>
|
|
11
11
|
raise ValueError(
|
|
12
12
|
"Returning before `@` is not allowed. "
|
|
13
|
-
"Use `return @MonadType.pure(value)` instead."
|
|
13
|
+
+ "Use `return @MonadType.pure(value)` instead."
|
|
14
14
|
)
|
|
15
15
|
|
|
16
16
|
try:
|
|
@@ -18,17 +18,17 @@ export do = f => wraps(f)& (*args, **kwargs) =>
|
|
|
18
18
|
# is it possible to derive bind_gen directly from bind_once?
|
|
19
19
|
|
|
20
20
|
return m.bind_gen(gen)
|
|
21
|
-
except AttributeError()
|
|
21
|
+
except AttributeError() =>
|
|
22
22
|
None
|
|
23
23
|
|
|
24
24
|
let recurse = v =>
|
|
25
25
|
try:
|
|
26
26
|
m = gen.send(v)
|
|
27
27
|
return m.bind_once(recurse)
|
|
28
|
-
except StopIteration() as e
|
|
28
|
+
except StopIteration() as e =>
|
|
29
29
|
return m.pure(e.value)
|
|
30
30
|
|
|
31
31
|
try:
|
|
32
32
|
return m.bind_once(recurse)
|
|
33
|
-
except AttributeError()
|
|
33
|
+
except AttributeError() =>
|
|
34
34
|
raise ValueError("@ can only be used with an object that has `bind_once`.")
|
|
@@ -26,7 +26,7 @@ export Env = class(MonadOnce):
|
|
|
26
26
|
|
|
27
27
|
bind_once = (self, f) => Env& ctx =>
|
|
28
28
|
let v = f(self.f(ctx))
|
|
29
|
-
if v matches
|
|
29
|
+
if v not matches Env():
|
|
30
30
|
raise ValueError(f"Expected the binder to return an Env, but got {type(v)}")
|
|
31
31
|
|
|
32
32
|
v.f(ctx)
|
|
@@ -35,9 +35,9 @@ export Env = class(MonadOnce):
|
|
|
35
35
|
try:
|
|
36
36
|
while True:
|
|
37
37
|
self = gen.send(self.f(ctx))
|
|
38
|
-
if self matches
|
|
38
|
+
if self not matches Env():
|
|
39
39
|
raise ValueError(f"Expected the binder to return an Env, but got {type(self)}")
|
|
40
|
-
except StopIteration(value=value)
|
|
40
|
+
except StopIteration(value=value) =>
|
|
41
41
|
return value
|
|
42
42
|
|
|
43
43
|
NoKey = object()
|
|
@@ -24,7 +24,7 @@ export Memo = class(MonadOnce):
|
|
|
24
24
|
|
|
25
25
|
__repr__ = self => f"Memo.Cache({self.cache})"
|
|
26
26
|
|
|
27
|
-
try_get = (self, name, deps) =>
|
|
27
|
+
try_get = (self, name, deps) => check self.cache[name][deps] except KeyError()
|
|
28
28
|
|
|
29
29
|
update = (self, name, deps, value) =>
|
|
30
30
|
self.cache[name][deps] = value
|
|
@@ -88,7 +88,7 @@ export Memo = class(MonadOnce):
|
|
|
88
88
|
bind_once = (self, f) => Memo(ctx =>
|
|
89
89
|
let value = f(self.f(ctx))
|
|
90
90
|
|
|
91
|
-
if value matches
|
|
91
|
+
if value not matches Memo():
|
|
92
92
|
raise ValueError(f"Expected the binder to return a Memo, but got {type(value)}")
|
|
93
93
|
|
|
94
94
|
return value.f(ctx)
|
|
@@ -100,10 +100,9 @@ export Memo = class(MonadOnce):
|
|
|
100
100
|
let inner = self.f(ctx)
|
|
101
101
|
self = gen.send(inner)
|
|
102
102
|
|
|
103
|
-
if self matches
|
|
103
|
+
if self not matches Memo():
|
|
104
104
|
raise ValueError(f"Expected the binder to return a Memo, but got {type(value)}")
|
|
105
|
-
|
|
106
|
-
except StopIteration(value=value):
|
|
105
|
+
except StopIteration(value=value) =>
|
|
107
106
|
return value
|
|
108
107
|
)
|
|
109
108
|
|
|
@@ -164,7 +163,7 @@ export AsyncMemo = class(MonadOnce):
|
|
|
164
163
|
bind_once = (self, f) => AsyncMemo(ctx =>
|
|
165
164
|
let value = f(@self.f(ctx))
|
|
166
165
|
|
|
167
|
-
if value matches
|
|
166
|
+
if value not matches AsyncMemo():
|
|
168
167
|
raise ValueError(f"Expected the binder to return a Memo, but got {type(value)}")
|
|
169
168
|
|
|
170
169
|
return value.f(ctx)
|
|
@@ -176,9 +175,9 @@ export AsyncMemo = class(MonadOnce):
|
|
|
176
175
|
let inner = @self.f(ctx)
|
|
177
176
|
self = gen.send(inner)
|
|
178
177
|
|
|
179
|
-
if self matches
|
|
178
|
+
if self not matches AsyncMemo():
|
|
180
179
|
raise ValueError(f"Expected the binder to return a Memo, but got {type(value)}")
|
|
181
180
|
|
|
182
|
-
except StopIteration(value=value)
|
|
181
|
+
except StopIteration(value=value) =>
|
|
183
182
|
return value
|
|
184
183
|
)
|
|
@@ -5,7 +5,7 @@ infer_ok = x =>
|
|
|
5
5
|
x match:
|
|
6
6
|
None => False
|
|
7
7
|
BaseException() => False
|
|
8
|
-
|
|
8
|
+
_ => True
|
|
9
9
|
|
|
10
10
|
op_coal = (x, f) =>
|
|
11
11
|
if x matches Result():
|
|
@@ -42,7 +42,7 @@ export Result = class(MonadOnce):
|
|
|
42
42
|
"""
|
|
43
43
|
try:
|
|
44
44
|
return Ok(f())
|
|
45
|
-
except BaseException() as e
|
|
45
|
+
except BaseException() as e =>
|
|
46
46
|
return Err(e)
|
|
47
47
|
|
|
48
48
|
bind_once = (self, f) =>
|
|
@@ -50,7 +50,7 @@ export Result = class(MonadOnce):
|
|
|
50
50
|
return self
|
|
51
51
|
|
|
52
52
|
let value = f(self.value)
|
|
53
|
-
if value matches
|
|
53
|
+
if value not matches Result():
|
|
54
54
|
raise ValueError(f"Expected the binder to return a Result, but got {type(value)}")
|
|
55
55
|
value
|
|
56
56
|
|
|
@@ -61,9 +61,9 @@ export Result = class(MonadOnce):
|
|
|
61
61
|
return self
|
|
62
62
|
|
|
63
63
|
self = gen.send(self.value)
|
|
64
|
-
if self matches
|
|
64
|
+
if self not matches Result():
|
|
65
65
|
raise ValueError(f"Expected the binder to return a Result, but got {type(self)}")
|
|
66
|
-
except StopIteration(value=value)
|
|
66
|
+
except StopIteration(value=value) =>
|
|
67
67
|
return Result(value)
|
|
68
68
|
|
|
69
69
|
pure = staticmethod& x => Ok(x)
|
|
@@ -5,14 +5,14 @@ import koatl.std.alg.Monad
|
|
|
5
5
|
export List = class(Monad):
|
|
6
6
|
__new__ = (cls, *args, **kwargs) => raise ValueError(
|
|
7
7
|
"List cannot be instantiated directly. "
|
|
8
|
-
"Use [] or list()."
|
|
8
|
+
+ "Use [] or list()."
|
|
9
9
|
)
|
|
10
10
|
|
|
11
11
|
bind_once = (self, f) =>
|
|
12
12
|
raise NotImplementedError(
|
|
13
13
|
"List may not be bound using @ "
|
|
14
|
-
"due to generator limitations. "
|
|
15
|
-
"Wrap in Ok to use the Result monad."
|
|
14
|
+
+ "due to generator limitations. "
|
|
15
|
+
+ "Wrap in Ok to use the Result monad."
|
|
16
16
|
)
|
|
17
17
|
|
|
18
18
|
bind = (self, f) => List(self.flat_map(f))
|
|
@@ -21,7 +21,7 @@ export Iterable = class(Traversable, Trait):
|
|
|
21
21
|
let value = next(it)
|
|
22
22
|
if not f(value):
|
|
23
23
|
return Iterable.chain([value], it)
|
|
24
|
-
except StopIteration()
|
|
24
|
+
except StopIteration() =>
|
|
25
25
|
return it
|
|
26
26
|
|
|
27
27
|
take = (self, n) =>
|
|
@@ -30,7 +30,7 @@ export Iterable = class(Traversable, Trait):
|
|
|
30
30
|
for _ in ..n:
|
|
31
31
|
try:
|
|
32
32
|
yield next(it)
|
|
33
|
-
except StopIteration(value=value)
|
|
33
|
+
except StopIteration(value=value) =>
|
|
34
34
|
return value
|
|
35
35
|
|
|
36
36
|
impl.__name__ = f"take"
|
|
@@ -152,7 +152,7 @@ export Iterable = class(Traversable, Trait):
|
|
|
152
152
|
return Err()
|
|
153
153
|
|
|
154
154
|
first = self =>
|
|
155
|
-
(
|
|
155
|
+
(check next(self.iter)).map_err(_ => None)
|
|
156
156
|
|
|
157
157
|
last = (self, f) =>
|
|
158
158
|
let result = Err()
|
|
@@ -212,7 +212,7 @@ export Iterable = class(Traversable, Trait):
|
|
|
212
212
|
m = v
|
|
213
213
|
else:
|
|
214
214
|
m = key(v)
|
|
215
|
-
except StopIteration(value=value)
|
|
215
|
+
except StopIteration(value=value) =>
|
|
216
216
|
raise ValueError("max of empty iterable")
|
|
217
217
|
|
|
218
218
|
|
|
@@ -239,7 +239,7 @@ export Iterable = class(Traversable, Trait):
|
|
|
239
239
|
m = v
|
|
240
240
|
else:
|
|
241
241
|
m = key(v)
|
|
242
|
-
except StopIteration(value=value)
|
|
242
|
+
except StopIteration(value=value) =>
|
|
243
243
|
raise ValueError("min of empty iterable")
|
|
244
244
|
|
|
245
245
|
if key === None:
|
|
@@ -272,7 +272,7 @@ export Iterable = class(Traversable, Trait):
|
|
|
272
272
|
let v
|
|
273
273
|
try:
|
|
274
274
|
v = next(it)
|
|
275
|
-
except StopIteration()
|
|
275
|
+
except StopIteration() =>
|
|
276
276
|
return []
|
|
277
277
|
|
|
278
278
|
let m = f(v)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
use koatl_core::{
|
|
1
|
+
use koatl_core::{py::ast::*, util::LineColCache, Span};
|
|
2
2
|
|
|
3
3
|
use pyo3::{
|
|
4
4
|
call::PyCallArgs,
|
|
@@ -512,21 +512,72 @@ trait PyLiteralExt<'src> {
|
|
|
512
512
|
impl<'src> PyLiteralExt<'src> for PyLiteral<'src> {
|
|
513
513
|
fn emit_py<'py>(&self, ctx: &PyCtx<'py, 'src>, span: &Span) -> PyTlResult<PyObject> {
|
|
514
514
|
Ok(match self {
|
|
515
|
-
PyLiteral::
|
|
515
|
+
PyLiteral::Int(num) => {
|
|
516
516
|
let num = num.replace('_', "");
|
|
517
|
-
|
|
518
517
|
match num.parse::<i128>() {
|
|
519
518
|
Ok(i) => ctx.ast_node("Constant", (i,), span)?,
|
|
520
|
-
Err(_) =>
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
519
|
+
Err(_) => {
|
|
520
|
+
return Err(PyTlErr {
|
|
521
|
+
message: format!("Invalid integer literal: {}", num),
|
|
522
|
+
py_err: None,
|
|
523
|
+
span: Some(*span),
|
|
524
|
+
});
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
PyLiteral::IntBin(num) => {
|
|
529
|
+
let num = num.replace('_', "");
|
|
530
|
+
// Keep the 0b prefix for Python compatibility
|
|
531
|
+
match i128::from_str_radix(&num[2..], 2) {
|
|
532
|
+
Ok(i) => ctx.ast_node("Constant", (i,), span)?,
|
|
533
|
+
Err(_) => {
|
|
534
|
+
return Err(PyTlErr {
|
|
535
|
+
message: format!("Invalid binary literal: {}", num),
|
|
536
|
+
py_err: None,
|
|
537
|
+
span: Some(*span),
|
|
538
|
+
});
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
PyLiteral::IntOct(num) => {
|
|
543
|
+
let num = num.replace('_', "");
|
|
544
|
+
// Keep the 0o prefix for Python compatibility
|
|
545
|
+
match i128::from_str_radix(&num[2..], 8) {
|
|
546
|
+
Ok(i) => ctx.ast_node("Constant", (i,), span)?,
|
|
547
|
+
Err(_) => {
|
|
548
|
+
return Err(PyTlErr {
|
|
549
|
+
message: format!("Invalid octal literal: {}", num),
|
|
550
|
+
py_err: None,
|
|
551
|
+
span: Some(*span),
|
|
552
|
+
});
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
PyLiteral::IntHex(num) => {
|
|
557
|
+
let num = num.replace('_', "");
|
|
558
|
+
// Keep the 0x prefix for Python compatibility
|
|
559
|
+
match i128::from_str_radix(&num[2..], 16) {
|
|
560
|
+
Ok(i) => ctx.ast_node("Constant", (i,), span)?,
|
|
561
|
+
Err(_) => {
|
|
562
|
+
return Err(PyTlErr {
|
|
563
|
+
message: format!("Invalid hexadecimal literal: {}", num),
|
|
564
|
+
py_err: None,
|
|
565
|
+
span: Some(*span),
|
|
566
|
+
});
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
PyLiteral::Float(num) => {
|
|
571
|
+
let num = num.replace('_', "");
|
|
572
|
+
match num.parse::<f64>() {
|
|
573
|
+
Ok(f) => ctx.ast_node("Constant", (f,), span)?,
|
|
574
|
+
Err(_) => {
|
|
575
|
+
return Err(PyTlErr {
|
|
576
|
+
message: format!("Invalid float literal: {}", num),
|
|
577
|
+
py_err: None,
|
|
578
|
+
span: Some(*span),
|
|
579
|
+
});
|
|
580
|
+
}
|
|
530
581
|
}
|
|
531
582
|
}
|
|
532
583
|
PyLiteral::Bool(b) => ctx.ast_node("Constant", (b,), span)?,
|