jaclang 0.8.4__py3-none-any.whl → 0.8.6__py3-none-any.whl
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.
Potentially problematic release.
This version of jaclang might be problematic. Click here for more details.
- jaclang/cli/cli.md +1 -0
- jaclang/cli/cli.py +109 -37
- jaclang/compiler/jac.lark +3 -3
- jaclang/compiler/larkparse/jac_parser.py +2 -2
- jaclang/compiler/parser.py +14 -21
- jaclang/compiler/passes/main/__init__.py +5 -1
- jaclang/compiler/passes/main/binder_pass.py +594 -0
- jaclang/compiler/passes/main/cfg_build_pass.py +21 -1
- jaclang/compiler/passes/main/import_pass.py +8 -256
- jaclang/compiler/passes/main/inheritance_pass.py +10 -3
- jaclang/compiler/passes/main/pyast_gen_pass.py +92 -77
- jaclang/compiler/passes/main/pyast_load_pass.py +24 -13
- jaclang/compiler/passes/main/sem_def_match_pass.py +1 -1
- jaclang/compiler/passes/main/sym_tab_build_pass.py +4 -0
- jaclang/compiler/passes/main/tests/fixtures/M1.jac +3 -0
- jaclang/compiler/passes/main/tests/fixtures/cfg_has_var.jac +12 -0
- jaclang/compiler/passes/main/tests/fixtures/cfg_if_no_else.jac +11 -0
- jaclang/compiler/passes/main/tests/fixtures/cfg_return.jac +9 -0
- jaclang/compiler/passes/main/tests/fixtures/checker_imported.jac +2 -0
- jaclang/compiler/passes/main/tests/fixtures/checker_importer.jac +6 -0
- jaclang/compiler/passes/main/tests/fixtures/data_spatial_types.jac +1 -1
- jaclang/compiler/passes/main/tests/fixtures/import_symbol_type_infer.jac +11 -0
- jaclang/compiler/passes/main/tests/fixtures/infer_type_assignment.jac +5 -0
- jaclang/compiler/passes/main/tests/fixtures/member_access_type_inferred.jac +13 -0
- jaclang/compiler/passes/main/tests/fixtures/member_access_type_resolve.jac +11 -0
- jaclang/compiler/passes/main/tests/fixtures/sym_binder.jac +47 -0
- jaclang/compiler/passes/main/tests/fixtures/type_annotation_assignment.jac +8 -0
- jaclang/compiler/passes/main/tests/test_binder_pass.py +111 -0
- jaclang/compiler/passes/main/tests/test_cfg_build_pass.py +62 -24
- jaclang/compiler/passes/main/tests/test_checker_pass.py +87 -0
- jaclang/compiler/passes/main/tests/test_pyast_gen_pass.py +13 -13
- jaclang/compiler/passes/main/tests/test_sem_def_match_pass.py +6 -6
- jaclang/compiler/passes/main/type_checker_pass.py +128 -0
- jaclang/compiler/passes/tool/doc_ir_gen_pass.py +2 -0
- jaclang/compiler/passes/tool/tests/fixtures/simple_walk_fmt.jac +3 -0
- jaclang/compiler/program.py +32 -11
- jaclang/compiler/tests/test_sr_errors.py +32 -0
- jaclang/compiler/type_system/__init__.py +1 -0
- jaclang/compiler/type_system/type_evaluator.py +421 -0
- jaclang/compiler/type_system/type_utils.py +41 -0
- jaclang/compiler/type_system/types.py +240 -0
- jaclang/compiler/unitree.py +36 -24
- jaclang/langserve/dev_engine.jac +645 -0
- jaclang/langserve/dev_server.jac +201 -0
- jaclang/langserve/engine.jac +24 -5
- jaclang/langserve/tests/server_test/test_lang_serve.py +2 -2
- jaclang/langserve/tests/test_dev_server.py +80 -0
- jaclang/langserve/tests/test_server.py +13 -0
- jaclang/runtimelib/builtin.py +28 -39
- jaclang/runtimelib/importer.py +34 -63
- jaclang/runtimelib/machine.py +48 -64
- jaclang/runtimelib/memory.py +23 -5
- jaclang/runtimelib/tests/fixtures/savable_object.jac +10 -2
- jaclang/runtimelib/utils.py +42 -6
- jaclang/tests/fixtures/edge_node_walk.jac +1 -1
- jaclang/tests/fixtures/edges_walk.jac +1 -1
- jaclang/tests/fixtures/gendot_bubble_sort.jac +1 -1
- jaclang/tests/fixtures/py_run.jac +8 -0
- jaclang/tests/fixtures/py_run.py +23 -0
- jaclang/tests/fixtures/pyfunc.py +2 -0
- jaclang/tests/fixtures/pyfunc_fmt.py +60 -0
- jaclang/tests/fixtures/pyfunc_fstr.py +25 -0
- jaclang/tests/fixtures/pyfunc_kwesc.py +33 -0
- jaclang/tests/fixtures/python_run_test.py +19 -0
- jaclang/tests/test_cli.py +107 -0
- jaclang/tests/test_language.py +106 -5
- jaclang/utils/lang_tools.py +6 -3
- jaclang/utils/module_resolver.py +90 -0
- jaclang/utils/symtable_test_helpers.py +125 -0
- jaclang/utils/test.py +3 -4
- jaclang/vendor/interegular/__init__.py +34 -0
- jaclang/vendor/interegular/comparator.py +163 -0
- jaclang/vendor/interegular/fsm.py +1015 -0
- jaclang/vendor/interegular/patterns.py +732 -0
- jaclang/vendor/interegular/py.typed +0 -0
- jaclang/vendor/interegular/utils/__init__.py +15 -0
- jaclang/vendor/interegular/utils/simple_parser.py +165 -0
- jaclang/vendor/interegular-0.3.3.dist-info/INSTALLER +1 -0
- jaclang/vendor/interegular-0.3.3.dist-info/LICENSE.txt +21 -0
- jaclang/vendor/interegular-0.3.3.dist-info/METADATA +64 -0
- jaclang/vendor/interegular-0.3.3.dist-info/RECORD +20 -0
- jaclang/vendor/interegular-0.3.3.dist-info/REQUESTED +0 -0
- jaclang/vendor/interegular-0.3.3.dist-info/WHEEL +5 -0
- jaclang/vendor/interegular-0.3.3.dist-info/top_level.txt +1 -0
- {jaclang-0.8.4.dist-info → jaclang-0.8.6.dist-info}/METADATA +2 -1
- {jaclang-0.8.4.dist-info → jaclang-0.8.6.dist-info}/RECORD +88 -43
- {jaclang-0.8.4.dist-info → jaclang-0.8.6.dist-info}/WHEEL +0 -0
- {jaclang-0.8.4.dist-info → jaclang-0.8.6.dist-info}/entry_points.txt +0 -0
jaclang/compiler/parser.py
CHANGED
|
@@ -523,7 +523,7 @@ class JacParser(Transform[uni.Source, uni.Module]):
|
|
|
523
523
|
or self.match(uni.FuncSignature)
|
|
524
524
|
or self.match(uni.EventSignature)
|
|
525
525
|
)
|
|
526
|
-
tail = self.match(list) or self.match(uni.
|
|
526
|
+
tail = self.match(list) or self.match(uni.Expr)
|
|
527
527
|
valid_tail = spec if tail is None else tail
|
|
528
528
|
valid_spec = None if tail is None else spec
|
|
529
529
|
impl = uni.ImplDef(
|
|
@@ -578,14 +578,12 @@ class JacParser(Transform[uni.Source, uni.Module]):
|
|
|
578
578
|
|
|
579
579
|
def impl_tail(
|
|
580
580
|
self, _: None
|
|
581
|
-
) -> Sequence[uni.EnumBlockStmt] | list[uni.CodeBlockStmt] | uni.
|
|
581
|
+
) -> Sequence[uni.EnumBlockStmt] | list[uni.CodeBlockStmt] | uni.Expr:
|
|
582
582
|
"""Grammar rule.
|
|
583
583
|
|
|
584
584
|
impl_tail: enum_block | block_tail
|
|
585
585
|
"""
|
|
586
|
-
tail = self.match(list) or self.consume(
|
|
587
|
-
uni.FuncCall
|
|
588
|
-
) # block_tail (KW_BY atomic_call)
|
|
586
|
+
tail = self.match(list) or self.consume(uni.Expr)
|
|
589
587
|
return tail
|
|
590
588
|
|
|
591
589
|
def archetype_decl(self, _: None) -> uni.ArchSpec:
|
|
@@ -772,7 +770,7 @@ class JacParser(Transform[uni.Source, uni.Module]):
|
|
|
772
770
|
signature = self.consume(uni.EventSignature)
|
|
773
771
|
|
|
774
772
|
# Handle block_tail
|
|
775
|
-
body_sn_or_call = self.match(list) or self.match(uni.
|
|
773
|
+
body_sn_or_call = self.match(list) or self.match(uni.Expr)
|
|
776
774
|
if body_sn_or_call is None:
|
|
777
775
|
is_abstract = self.match_token(Tok.KW_ABSTRACT) is not None
|
|
778
776
|
self.consume_token(Tok.SEMI)
|
|
@@ -812,7 +810,7 @@ class JacParser(Transform[uni.Source, uni.Module]):
|
|
|
812
810
|
signature = self.match(uni.FuncSignature)
|
|
813
811
|
|
|
814
812
|
# Handle block_tail
|
|
815
|
-
body_sn_or_call = self.match(list) or self.match(uni.
|
|
813
|
+
body_sn_or_call = self.match(list) or self.match(uni.Expr)
|
|
816
814
|
if body_sn_or_call is None:
|
|
817
815
|
is_abstract = self.match_token(Tok.KW_ABSTRACT) is not None
|
|
818
816
|
self.consume_token(Tok.SEMI)
|
|
@@ -1867,15 +1865,13 @@ class JacParser(Transform[uni.Source, uni.Module]):
|
|
|
1867
1865
|
def atomic_call(self, _: None) -> uni.FuncCall:
|
|
1868
1866
|
"""Grammar rule.
|
|
1869
1867
|
|
|
1870
|
-
atomic_call: atomic_chain LPAREN param_list?
|
|
1868
|
+
atomic_call: atomic_chain LPAREN param_list? by_llm? RPAREN
|
|
1871
1869
|
"""
|
|
1872
|
-
genai_call: uni.FuncCall | None = None
|
|
1873
1870
|
target = self.consume(uni.Expr)
|
|
1874
1871
|
self.consume_token(Tok.LPAREN)
|
|
1875
1872
|
params_sn = self.match(list)
|
|
1876
|
-
genai_call = self.match(uni.
|
|
1873
|
+
genai_call = self.match(uni.Expr)
|
|
1877
1874
|
self.consume_token(Tok.RPAREN)
|
|
1878
|
-
body_genai_call = self.match(uni.FuncCall)
|
|
1879
1875
|
|
|
1880
1876
|
return uni.FuncCall(
|
|
1881
1877
|
target=target,
|
|
@@ -1885,19 +1881,16 @@ class JacParser(Transform[uni.Source, uni.Module]):
|
|
|
1885
1881
|
else []
|
|
1886
1882
|
),
|
|
1887
1883
|
genai_call=genai_call,
|
|
1888
|
-
body_genai_call=body_genai_call,
|
|
1889
1884
|
kid=self.flat_cur_nodes,
|
|
1890
1885
|
)
|
|
1891
1886
|
|
|
1892
|
-
def
|
|
1887
|
+
def by_llm(self, _: None) -> uni.Expr:
|
|
1893
1888
|
"""Grammar rule.
|
|
1894
1889
|
|
|
1895
|
-
|
|
1890
|
+
by_llm: KW_BY expression
|
|
1896
1891
|
"""
|
|
1897
1892
|
self.consume_token(Tok.KW_BY)
|
|
1898
|
-
|
|
1899
|
-
return call
|
|
1900
|
-
raise ValueError("Expected a function call")
|
|
1893
|
+
return self.consume(uni.Expr)
|
|
1901
1894
|
|
|
1902
1895
|
def index_slice(self, _: None) -> uni.IndexSlice:
|
|
1903
1896
|
"""Grammar rule.
|
|
@@ -2924,18 +2917,18 @@ class JacParser(Transform[uni.Source, uni.Module]):
|
|
|
2924
2917
|
kid=self.cur_nodes,
|
|
2925
2918
|
)
|
|
2926
2919
|
|
|
2927
|
-
def block_tail(self, _: None) -> list[uni.CodeBlockStmt] | uni.
|
|
2920
|
+
def block_tail(self, _: None) -> list[uni.CodeBlockStmt] | uni.Expr:
|
|
2928
2921
|
"""Grammar rule.
|
|
2929
2922
|
|
|
2930
|
-
block_tail: code_block | KW_BY
|
|
2923
|
+
block_tail: code_block | KW_BY expression SEMI
|
|
2931
2924
|
"""
|
|
2932
2925
|
# Try to match code_block first
|
|
2933
2926
|
if code_block := self.match(list):
|
|
2934
2927
|
return code_block
|
|
2935
2928
|
|
|
2936
|
-
# Otherwise, it must be KW_BY
|
|
2929
|
+
# Otherwise, it must be KW_BY expression SEMI
|
|
2937
2930
|
by_token = self.consume_token(Tok.KW_BY)
|
|
2938
|
-
func_call = self.consume(uni.
|
|
2931
|
+
func_call = self.consume(uni.Expr)
|
|
2939
2932
|
semi_token = self.consume_token(Tok.SEMI)
|
|
2940
2933
|
|
|
2941
2934
|
# Add the tokens to the function call's kid array
|
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
from ..transform import Alert, Transform # noqa: I100
|
|
4
4
|
from .annex_pass import JacAnnexPass # noqa: I100
|
|
5
|
+
from .binder_pass import BinderPass # noqa: I100
|
|
5
6
|
from .sym_tab_build_pass import SymTabBuildPass, UniPass # noqa: I100
|
|
6
7
|
from .sym_tab_link_pass import SymTabLinkPass # noqa: I100
|
|
7
8
|
from .def_use_pass import DefUsePass # noqa: I100
|
|
8
9
|
from .sem_def_match_pass import SemDefMatchPass # noqa: I100
|
|
9
|
-
from .import_pass import JacImportDepsPass
|
|
10
|
+
from .import_pass import JacImportDepsPass # noqa: I100
|
|
10
11
|
from .def_impl_match_pass import DeclImplMatchPass # noqa: I100
|
|
12
|
+
from .type_checker_pass import TypeCheckPass # noqa: I100
|
|
11
13
|
from .pyast_load_pass import PyastBuildPass # type: ignore # noqa: I100
|
|
12
14
|
from .pyast_gen_pass import PyastGenPass # noqa: I100
|
|
13
15
|
from .pybc_gen_pass import PyBytecodeGenPass # noqa: I100
|
|
@@ -23,6 +25,8 @@ __all__ = [
|
|
|
23
25
|
"JacAnnexPass",
|
|
24
26
|
"JacImportDepsPass",
|
|
25
27
|
"PyImportDepsPass",
|
|
28
|
+
"BinderPass",
|
|
29
|
+
"TypeCheckPass",
|
|
26
30
|
"SymTabBuildPass",
|
|
27
31
|
"SymTabLinkPass",
|
|
28
32
|
"DeclImplMatchPass",
|