jaclang 0.8.8__py3-none-any.whl → 0.8.10__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.py +194 -10
- jaclang/cli/cmdreg.py +144 -8
- jaclang/compiler/__init__.py +6 -1
- jaclang/compiler/codeinfo.py +16 -1
- jaclang/compiler/constant.py +33 -8
- jaclang/compiler/jac.lark +154 -62
- jaclang/compiler/larkparse/jac_parser.py +2 -2
- jaclang/compiler/parser.py +656 -149
- jaclang/compiler/passes/__init__.py +2 -1
- jaclang/compiler/passes/ast_gen/__init__.py +5 -0
- jaclang/compiler/passes/ast_gen/base_ast_gen_pass.py +54 -0
- jaclang/compiler/passes/ast_gen/jsx_processor.py +344 -0
- jaclang/compiler/passes/ecmascript/__init__.py +25 -0
- jaclang/compiler/passes/ecmascript/es_unparse.py +576 -0
- jaclang/compiler/passes/ecmascript/esast_gen_pass.py +2068 -0
- jaclang/compiler/passes/ecmascript/estree.py +972 -0
- jaclang/compiler/passes/ecmascript/tests/__init__.py +1 -0
- jaclang/compiler/passes/ecmascript/tests/fixtures/advanced_language_features.jac +170 -0
- jaclang/compiler/passes/ecmascript/tests/fixtures/class_separate_impl.impl.jac +30 -0
- jaclang/compiler/passes/ecmascript/tests/fixtures/class_separate_impl.jac +14 -0
- jaclang/compiler/passes/ecmascript/tests/fixtures/client_jsx.jac +89 -0
- jaclang/compiler/passes/ecmascript/tests/fixtures/core_language_features.jac +195 -0
- jaclang/compiler/passes/ecmascript/tests/test_esast_gen_pass.py +167 -0
- jaclang/compiler/passes/ecmascript/tests/test_js_generation.py +239 -0
- jaclang/compiler/passes/main/__init__.py +0 -3
- jaclang/compiler/passes/main/annex_pass.py +23 -1
- jaclang/compiler/passes/main/def_use_pass.py +1 -0
- jaclang/compiler/passes/main/pyast_gen_pass.py +413 -255
- jaclang/compiler/passes/main/pyast_load_pass.py +48 -11
- jaclang/compiler/passes/main/pyjac_ast_link_pass.py +2 -0
- jaclang/compiler/passes/main/sym_tab_build_pass.py +18 -1
- jaclang/compiler/passes/main/tests/fixtures/autoimpl.cl.jac +7 -0
- jaclang/compiler/passes/main/tests/fixtures/checker_arity.jac +3 -0
- jaclang/compiler/passes/main/tests/fixtures/checker_class_construct.jac +33 -0
- jaclang/compiler/passes/main/tests/fixtures/defuse_modpath.jac +7 -0
- jaclang/compiler/passes/main/tests/fixtures/member_access_type_resolve.jac +2 -1
- jaclang/compiler/passes/main/tests/test_checker_pass.py +31 -3
- jaclang/compiler/passes/main/tests/test_def_use_pass.py +12 -0
- jaclang/compiler/passes/main/tests/test_import_pass.py +23 -4
- jaclang/compiler/passes/main/tests/test_predynamo_pass.py +13 -14
- jaclang/compiler/passes/main/tests/test_pyast_gen_pass.py +25 -0
- jaclang/compiler/passes/main/type_checker_pass.py +7 -0
- jaclang/compiler/passes/tool/doc_ir_gen_pass.py +219 -20
- jaclang/compiler/passes/tool/fuse_comments_pass.py +1 -10
- jaclang/compiler/passes/tool/jac_formatter_pass.py +2 -2
- jaclang/compiler/passes/tool/tests/fixtures/import_fmt.jac +7 -1
- jaclang/compiler/passes/tool/tests/fixtures/tagbreak.jac +135 -29
- jaclang/compiler/passes/tool/tests/test_jac_format_pass.py +4 -1
- jaclang/compiler/passes/transform.py +9 -1
- jaclang/compiler/passes/uni_pass.py +5 -7
- jaclang/compiler/program.py +27 -26
- jaclang/compiler/tests/test_client_codegen.py +113 -0
- jaclang/compiler/tests/test_importer.py +12 -10
- jaclang/compiler/tests/test_parser.py +249 -3
- jaclang/compiler/type_system/type_evaluator.jac +1078 -0
- jaclang/compiler/type_system/type_utils.py +1 -1
- jaclang/compiler/type_system/types.py +6 -0
- jaclang/compiler/unitree.py +438 -82
- jaclang/langserve/engine.jac +224 -288
- jaclang/langserve/sem_manager.jac +12 -8
- jaclang/langserve/server.jac +48 -48
- jaclang/langserve/tests/fixtures/greet.py +17 -0
- jaclang/langserve/tests/fixtures/md_path.jac +22 -0
- jaclang/langserve/tests/fixtures/user.jac +15 -0
- jaclang/langserve/tests/test_server.py +66 -371
- jaclang/lib.py +17 -0
- jaclang/runtimelib/archetype.py +25 -25
- jaclang/runtimelib/client_bundle.py +169 -0
- jaclang/runtimelib/client_runtime.jac +586 -0
- jaclang/runtimelib/constructs.py +4 -2
- jaclang/runtimelib/machine.py +308 -139
- jaclang/runtimelib/meta_importer.py +111 -22
- jaclang/runtimelib/mtp.py +15 -0
- jaclang/runtimelib/server.py +1089 -0
- jaclang/runtimelib/tests/fixtures/client_app.jac +18 -0
- jaclang/runtimelib/tests/fixtures/custom_access_validation.jac +1 -1
- jaclang/runtimelib/tests/fixtures/savable_object.jac +4 -5
- jaclang/runtimelib/tests/fixtures/serve_api.jac +75 -0
- jaclang/runtimelib/tests/test_client_bundle.py +55 -0
- jaclang/runtimelib/tests/test_client_render.py +63 -0
- jaclang/runtimelib/tests/test_serve.py +1069 -0
- jaclang/settings.py +0 -3
- jaclang/tests/fixtures/attr_pattern_case.jac +18 -0
- jaclang/tests/fixtures/funccall_genexpr.jac +7 -0
- jaclang/tests/fixtures/funccall_genexpr.py +5 -0
- jaclang/tests/fixtures/iife_functions.jac +142 -0
- jaclang/tests/fixtures/iife_functions_client.jac +143 -0
- jaclang/tests/fixtures/multistatement_lambda.jac +116 -0
- jaclang/tests/fixtures/multistatement_lambda_client.jac +113 -0
- jaclang/tests/fixtures/needs_import_dup.jac +6 -4
- jaclang/tests/fixtures/py2jac_empty.py +0 -0
- jaclang/tests/fixtures/py_run.py +7 -5
- jaclang/tests/fixtures/pyfunc_fstr.py +2 -2
- jaclang/tests/fixtures/simple_lambda_test.jac +12 -0
- jaclang/tests/test_cli.py +134 -18
- jaclang/tests/test_language.py +120 -32
- jaclang/tests/test_reference.py +20 -3
- jaclang/utils/NonGPT.py +375 -0
- jaclang/utils/helpers.py +64 -20
- jaclang/utils/lang_tools.py +31 -4
- jaclang/utils/tests/test_lang_tools.py +5 -16
- jaclang/utils/treeprinter.py +8 -3
- {jaclang-0.8.8.dist-info → jaclang-0.8.10.dist-info}/METADATA +3 -3
- {jaclang-0.8.8.dist-info → jaclang-0.8.10.dist-info}/RECORD +106 -71
- jaclang/compiler/passes/main/binder_pass.py +0 -594
- jaclang/compiler/passes/main/tests/fixtures/sym_binder.jac +0 -47
- jaclang/compiler/passes/main/tests/test_binder_pass.py +0 -111
- jaclang/compiler/type_system/type_evaluator.py +0 -844
- jaclang/langserve/tests/session.jac +0 -294
- jaclang/langserve/tests/test_dev_server.py +0 -80
- jaclang/runtimelib/importer.py +0 -351
- jaclang/tests/test_typecheck.py +0 -542
- {jaclang-0.8.8.dist-info → jaclang-0.8.10.dist-info}/WHEEL +0 -0
- {jaclang-0.8.8.dist-info → jaclang-0.8.10.dist-info}/entry_points.txt +0 -0
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
"""Test Binder pass."""
|
|
2
|
-
|
|
3
|
-
from jaclang.compiler.program import JacProgram
|
|
4
|
-
from jaclang.utils.symtable_test_helpers import SymTableTestMixin
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class BinderPassTests( SymTableTestMixin):
|
|
8
|
-
"""Test pass module."""
|
|
9
|
-
|
|
10
|
-
def setUp(self) -> None:
|
|
11
|
-
"""Set up test."""
|
|
12
|
-
return super().setUp()
|
|
13
|
-
|
|
14
|
-
def test_glob_sym_build(self) -> None:
|
|
15
|
-
"""Test symbol table construction for symbol_binding_test.jac fixture."""
|
|
16
|
-
mod_targ = JacProgram().bind(self.fixture_abs_path("sym_binder.jac"))
|
|
17
|
-
sym_table = mod_targ.sym_tab
|
|
18
|
-
|
|
19
|
-
#currenlty 'aa' is not in the main table, need fix #TODO
|
|
20
|
-
# defns=[(9, 6), (16, 5), (27, 9), (32, 5)],
|
|
21
|
-
# uses=[(33, 11), (37, 11)]
|
|
22
|
-
# Test global variable 'aa'
|
|
23
|
-
self.assert_symbol_complete(
|
|
24
|
-
sym_table, "aa", "variable",
|
|
25
|
-
decl=(9, 6),
|
|
26
|
-
defns=[(9, 6), (16, 5), ],
|
|
27
|
-
uses=[ (37, 11)]
|
|
28
|
-
)
|
|
29
|
-
|
|
30
|
-
# Test global variable 'n'
|
|
31
|
-
self.assert_symbol_complete(
|
|
32
|
-
sym_table, "n", "variable",
|
|
33
|
-
decl=(14, 5),
|
|
34
|
-
defns=[(14, 5)]
|
|
35
|
-
)
|
|
36
|
-
|
|
37
|
-
# Test imported module 'M1'
|
|
38
|
-
self.assert_symbol_complete(
|
|
39
|
-
sym_table, "M1", "module",
|
|
40
|
-
decl=(1, 8),
|
|
41
|
-
defns=[(1, 8)]
|
|
42
|
-
)
|
|
43
|
-
|
|
44
|
-
# Test global variable 'z'
|
|
45
|
-
self.assert_symbol_complete(
|
|
46
|
-
sym_table, "z", "variable",
|
|
47
|
-
decl=(15, 5),
|
|
48
|
-
defns=[(15, 5)]
|
|
49
|
-
)
|
|
50
|
-
|
|
51
|
-
# Test global variable 'Y'
|
|
52
|
-
self.assert_symbol_complete(
|
|
53
|
-
sym_table, "Y", "variable",
|
|
54
|
-
decl=(11, 5),
|
|
55
|
-
defns=[(11, 5), (12, 5), (19, 5)],
|
|
56
|
-
uses=[(15, 9)]
|
|
57
|
-
)
|
|
58
|
-
|
|
59
|
-
# Test ability 'ccc'
|
|
60
|
-
self.assert_symbol_complete(
|
|
61
|
-
sym_table, "ccc", "ability",
|
|
62
|
-
decl=(22, 5),
|
|
63
|
-
defns=[(22, 5)],
|
|
64
|
-
uses=[(36, 5)]
|
|
65
|
-
)
|
|
66
|
-
|
|
67
|
-
#TODO: Fix the following test, 'bb' is not in the main table
|
|
68
|
-
# # Test global variable 'bb'
|
|
69
|
-
# self.assert_symbol_complete(
|
|
70
|
-
# sym_table, "bb", "variable",
|
|
71
|
-
# decl=(26, 17),
|
|
72
|
-
# defns=[(26, 17), (28, 9)]
|
|
73
|
-
# )
|
|
74
|
-
|
|
75
|
-
# Test sub-table for ability 'ccc'
|
|
76
|
-
ccc_table = self.assert_sub_table_exists(sym_table, "ccc",'ability')
|
|
77
|
-
|
|
78
|
-
# Test sub-table for if statement inside 'ccc'
|
|
79
|
-
if_table = self.assert_sub_table_exists(ccc_table, "IfStmt",'variable')
|
|
80
|
-
|
|
81
|
-
# Test local variable 'p' inside if statement
|
|
82
|
-
self.assert_symbol_complete(
|
|
83
|
-
if_table, "p", "variable",
|
|
84
|
-
decl=(29, 9),
|
|
85
|
-
defns=[(29, 9)]
|
|
86
|
-
)
|
|
87
|
-
|
|
88
|
-
def test_symbol_table_structure(self) -> None:
|
|
89
|
-
"""Test the overall structure of the symbol table."""
|
|
90
|
-
mod_targ = JacProgram().build(self.fixture_abs_path("sym_binder.jac"))
|
|
91
|
-
sym_table = mod_targ.sym_tab
|
|
92
|
-
|
|
93
|
-
# Verify main module table exists
|
|
94
|
-
self.assertIn("sym_binder", str(sym_table))
|
|
95
|
-
|
|
96
|
-
# Verify expected number of symbols in main table
|
|
97
|
-
main_symbols = ["aa", "n", "M1", "z", "Y", "ccc"]
|
|
98
|
-
# 'bb' is not here:need fix #TODO
|
|
99
|
-
for symbol_name in main_symbols:
|
|
100
|
-
self.assert_symbol_exists(sym_table, symbol_name)
|
|
101
|
-
|
|
102
|
-
# Verify sub-tables exist
|
|
103
|
-
sub_tables = sym_table.kid_scope
|
|
104
|
-
self.assertTrue(len(sub_tables) > 0, "No sub-tables found")
|
|
105
|
-
|
|
106
|
-
# Verify ability sub-table has nested if-statement table
|
|
107
|
-
ccc_table = self.assert_sub_table_exists(sym_table, "ccc", 'ability')
|
|
108
|
-
if_table = self.assert_sub_table_exists(ccc_table, "IfStmt", 'variable')
|
|
109
|
-
|
|
110
|
-
# Verify if-statement table contains local variable
|
|
111
|
-
self.assert_symbol_exists(if_table, "p")
|