jaclang 0.8.1__py3-none-any.whl → 0.8.2__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/__init__.py +6 -0
- jaclang/cli/cli.py +21 -50
- jaclang/compiler/codeinfo.py +0 -1
- jaclang/compiler/jac.lark +12 -10
- jaclang/compiler/larkparse/jac_parser.py +2 -2
- jaclang/compiler/parser.py +18 -10
- jaclang/compiler/passes/main/__init__.py +0 -14
- jaclang/compiler/passes/main/annex_pass.py +2 -8
- jaclang/compiler/passes/main/cfg_build_pass.py +38 -12
- jaclang/compiler/passes/main/import_pass.py +3 -11
- jaclang/compiler/passes/main/pyast_gen_pass.py +243 -592
- jaclang/compiler/passes/main/sym_tab_link_pass.py +2 -5
- jaclang/compiler/passes/main/tests/test_cfg_build_pass.py +2 -8
- jaclang/compiler/passes/main/tests/test_decl_impl_match_pass.py +7 -8
- jaclang/compiler/passes/main/tests/test_import_pass.py +5 -18
- jaclang/compiler/passes/main/tests/test_pyast_gen_pass.py +2 -6
- jaclang/compiler/passes/main/tests/test_sub_node_pass.py +1 -3
- jaclang/compiler/passes/main/tests/test_sym_tab_link_pass.py +20 -17
- jaclang/compiler/passes/tool/doc_ir_gen_pass.py +237 -105
- jaclang/compiler/passes/tool/jac_formatter_pass.py +2 -0
- jaclang/compiler/passes/tool/tests/fixtures/archetype_frmt.jac +14 -0
- jaclang/compiler/passes/tool/tests/fixtures/general_format_checks/triple_quoted_string.jac +5 -4
- jaclang/compiler/passes/tool/tests/fixtures/import_fmt.jac +6 -0
- jaclang/compiler/passes/tool/tests/fixtures/simple_walk_fmt.jac +3 -3
- jaclang/compiler/passes/tool/tests/fixtures/tagbreak.jac +9 -0
- jaclang/compiler/passes/tool/tests/test_jac_format_pass.py +18 -3
- jaclang/compiler/passes/tool/tests/test_unparse_validate.py +2 -2
- jaclang/compiler/program.py +21 -60
- jaclang/compiler/tests/fixtures/pkg_import_lib_py/__init__.py +2 -8
- jaclang/compiler/tests/fixtures/pkg_import_lib_py/sub/__init__.py +1 -5
- jaclang/compiler/tests/test_importer.py +10 -13
- jaclang/compiler/unitree.py +32 -16
- jaclang/langserve/__init__.jac +1 -1
- jaclang/langserve/engine.jac +113 -108
- jaclang/langserve/server.jac +17 -2
- jaclang/langserve/tests/server_test/test_lang_serve.py +138 -46
- jaclang/langserve/tests/server_test/utils.py +35 -9
- jaclang/langserve/tests/test_sem_tokens.py +1 -1
- jaclang/langserve/tests/test_server.py +3 -7
- jaclang/runtimelib/archetype.py +127 -5
- jaclang/runtimelib/importer.py +51 -94
- jaclang/runtimelib/machine.py +391 -268
- jaclang/runtimelib/meta_importer.py +86 -0
- jaclang/runtimelib/tests/fixtures/graph_purger.jac +24 -26
- jaclang/runtimelib/tests/fixtures/other_root_access.jac +25 -16
- jaclang/runtimelib/tests/test_jaseci.py +3 -1
- jaclang/tests/fixtures/arch_rel_import_creation.jac +23 -23
- jaclang/tests/fixtures/async_ability.jac +43 -10
- jaclang/tests/fixtures/async_function.jac +18 -0
- jaclang/tests/fixtures/async_walker.jac +17 -12
- jaclang/tests/fixtures/create_dynamic_archetype.jac +25 -28
- jaclang/tests/fixtures/deep/deeper/deep_outer_import.jac +7 -4
- jaclang/tests/fixtures/deep/deeper/snd_lev.jac +2 -2
- jaclang/tests/fixtures/deep/deeper/snd_lev_dup.jac +6 -0
- jaclang/tests/fixtures/deep/one_lev.jac +2 -2
- jaclang/tests/fixtures/deep/one_lev_dup.jac +4 -3
- jaclang/tests/fixtures/dynamic_archetype.jac +19 -12
- jaclang/tests/fixtures/foo.jac +14 -22
- jaclang/tests/fixtures/jac_from_py.py +1 -1
- jaclang/tests/fixtures/jp_importer.jac +6 -6
- jaclang/tests/fixtures/jp_importer_auto.jac +5 -3
- jaclang/tests/fixtures/unicode_strings.jac +24 -0
- jaclang/tests/fixtures/walker_update.jac +5 -7
- jaclang/tests/test_language.py +138 -140
- jaclang/tests/test_reference.py +9 -4
- jaclang/tests/test_typecheck.py +13 -26
- jaclang/utils/lang_tools.py +7 -5
- jaclang/utils/module_resolver.py +23 -0
- {jaclang-0.8.1.dist-info → jaclang-0.8.2.dist-info}/METADATA +1 -1
- {jaclang-0.8.1.dist-info → jaclang-0.8.2.dist-info}/RECORD +72 -70
- jaclang/compiler/passes/main/tests/fixtures/main_err.jac +0 -6
- jaclang/compiler/passes/main/tests/fixtures/second_err.jac +0 -4
- jaclang/compiler/passes/tool/tests/fixtures/corelib.jac +0 -644
- jaclang/compiler/passes/tool/tests/test_doc_ir_gen_pass.py +0 -29
- jaclang/tests/fixtures/deep/deeper/__init__.jac +0 -1
- {jaclang-0.8.1.dist-info → jaclang-0.8.2.dist-info}/WHEEL +0 -0
- {jaclang-0.8.1.dist-info → jaclang-0.8.2.dist-info}/entry_points.txt +0 -0
|
@@ -1,30 +1,37 @@
|
|
|
1
|
-
import from jaclang.runtimelib.machine {
|
|
2
|
-
import from bar {Item}
|
|
1
|
+
import from jaclang.runtimelib.machine { JacMachine }
|
|
2
|
+
import from bar { Item }
|
|
3
|
+
|
|
3
4
|
|
|
4
5
|
node test_node {
|
|
5
|
-
has value:int;
|
|
6
|
+
has value: int;
|
|
6
7
|
}
|
|
7
8
|
|
|
9
|
+
|
|
8
10
|
walker test_walker {
|
|
9
11
|
can visit_nodes with `root entry {
|
|
10
12
|
visit [-->];
|
|
11
13
|
}
|
|
12
|
-
|
|
14
|
+
|
|
13
15
|
can print_value with test_node | Item entry {
|
|
14
16
|
print("Value:", f'{here.value}');
|
|
15
17
|
}
|
|
16
18
|
}
|
|
17
19
|
|
|
18
|
-
|
|
20
|
+
|
|
21
|
+
walker child_walker ( test_walker ) {}
|
|
22
|
+
|
|
19
23
|
|
|
20
24
|
with entry {
|
|
21
|
-
for value in range(1, 4) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
for value in range(1, 4) { root ++> test_node(value=value); root ++> Item(value=value); }
|
|
26
|
+
node_obj = JacMachine.spawn_node(
|
|
27
|
+
node_name='test_node', attributes={'value' : 0 }, module_name='__main__'
|
|
28
|
+
);
|
|
29
|
+
walker_obj = JacMachine.spawn_walker(
|
|
30
|
+
walker_name='child_walker', module_name='__main__'
|
|
31
|
+
);
|
|
32
|
+
external_node = JacMachine.spawn_node(
|
|
33
|
+
node_name='Item', attributes={'value' : 0 }, module_name='bar'
|
|
34
|
+
);
|
|
28
35
|
root ++> external_node;
|
|
29
36
|
root ++> node_obj;
|
|
30
37
|
print("Spawned Node:", node_obj);
|
jaclang/tests/fixtures/foo.jac
CHANGED
|
@@ -1,42 +1,34 @@
|
|
|
1
|
-
import from jaclang.runtimelib.machine {
|
|
2
|
-
import from bar { bar_walk }
|
|
1
|
+
import from jaclang.runtimelib.machine { JacMachine }
|
|
2
|
+
import from bar { bar_walk }
|
|
3
3
|
# Test runner to initialize the walker
|
|
4
|
-
|
|
5
|
-
def test_run {
|
|
4
|
+
def test_run {
|
|
6
5
|
# Print the loaded modules
|
|
7
|
-
|
|
6
|
+
modules = JacMachine.list_modules();
|
|
8
7
|
"Loaded Modules:" |> print;
|
|
9
|
-
for mod_name in modules {
|
|
10
|
-
f"Module: {mod_name}" |> print;
|
|
11
|
-
}
|
|
8
|
+
for mod_name in modules { f"Module: {mod_name}" |> print; }
|
|
12
9
|
# Print walkers
|
|
13
|
-
|
|
10
|
+
walkers = JacMachine.list_walkers(mod_name);
|
|
14
11
|
if walkers {
|
|
15
12
|
f"Walkers in {mod_name}:" |> print;
|
|
16
|
-
for walker in walkers {
|
|
17
|
-
f" - Walker: {walker}" |> print;
|
|
18
|
-
}
|
|
13
|
+
for walker in walkers { f" - Walker: {walker}" |> print; }
|
|
19
14
|
}
|
|
20
15
|
# Print nodes
|
|
21
|
-
|
|
16
|
+
nodes = JacMachine.list_nodes(mod_name);
|
|
22
17
|
if nodes {
|
|
23
18
|
f"Nodes in {mod_name}:" |> print;
|
|
24
|
-
for node in nodes {
|
|
25
|
-
f" - Node: {node}" |> print;
|
|
26
|
-
}
|
|
19
|
+
for node in nodes { f" - Node: {node}" |> print; }
|
|
27
20
|
}
|
|
28
21
|
# Print edges
|
|
29
|
-
|
|
22
|
+
edges = JacMachine.list_edges(mod_name);
|
|
30
23
|
if edges {
|
|
31
24
|
f"Edges in {mod_name}:" |> print;
|
|
32
|
-
for edge in edges {
|
|
33
|
-
f" - Edge: {edge}" |> print;
|
|
34
|
-
}
|
|
25
|
+
for edge in edges { f" - Edge: {edge}" |> print; }
|
|
35
26
|
}
|
|
36
27
|
root spawn bar_walk();
|
|
37
28
|
}
|
|
38
|
-
# Define the entry point to run the test
|
|
39
29
|
|
|
40
|
-
|
|
30
|
+
|
|
31
|
+
# Define the entry point to run the test
|
|
32
|
+
with entry {
|
|
41
33
|
test_run();
|
|
42
34
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import from math { sin as s, cos, sqrt as sq }
|
|
1
|
+
import from math { sin as s , cos , sqrt as sq }
|
|
2
2
|
include random;
|
|
3
|
-
import from
|
|
3
|
+
import from jaclang.tests.test_cli { JacCliTests as Jac }
|
|
4
4
|
import from deep.mycode { code as c }
|
|
5
|
-
import hashcheck as h, assign_compr as a;
|
|
5
|
+
import hashcheck as h , assign_compr as a;
|
|
6
6
|
import ignore;
|
|
7
7
|
import from jacsamp { my_print as m }
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
with entry{
|
|
11
|
-
print(sq(4), s(30),cos(30));
|
|
10
|
+
with entry {
|
|
11
|
+
print(sq(4), s(30), cos(30));
|
|
12
12
|
print(randint(1, 10));
|
|
13
13
|
print(m("--->my_print<---"));
|
|
14
14
|
print(h.a, a.mvar);
|
|
15
15
|
print(c());
|
|
16
|
-
|
|
16
|
+
}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import from math { sin as s, cos, sqrt as sq }
|
|
1
|
+
import from math { sin as s , cos , sqrt as sq }
|
|
2
2
|
include random;
|
|
3
|
-
import from
|
|
3
|
+
import from jaclang.tests.test_cli { JacCliTests as Jac }
|
|
4
4
|
import from deep.mycode { code as c }
|
|
5
|
-
import hashcheck as h, assign_compr as a;
|
|
5
|
+
import hashcheck as h , assign_compr as a;
|
|
6
6
|
import from jacsamp { my_print as m }
|
|
7
7
|
|
|
8
|
+
|
|
8
9
|
with entry {
|
|
9
10
|
print(sq(4), s(30), cos(30));
|
|
10
11
|
print(randint(1, 10));
|
|
11
12
|
print(m("--->my_print<---"));
|
|
12
13
|
print(h.a, a.mvar);
|
|
13
14
|
print(c());
|
|
15
|
+
print(Jac);
|
|
14
16
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
with entry {
|
|
2
|
+
# unicode characters
|
|
3
|
+
items = [{"title":"1st", "due":True, "completed":True}, {"title":"2nd", "due":False, "completed":False}];
|
|
4
|
+
for (i, item) in enumerate(items) {
|
|
5
|
+
status = "✓" if item["completed"] else "○";
|
|
6
|
+
due = f" (due: {item['due']})" if item["due"] else "";
|
|
7
|
+
print(f"{i+1}. {status} {item['title']}{due}");
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
# unicode emojis and symbols
|
|
11
|
+
print("🌟 Star");
|
|
12
|
+
|
|
13
|
+
# unicode in triple quoted strings
|
|
14
|
+
multiline = """Multi-line with ✓ unicode and ○ symbols""";
|
|
15
|
+
print(multiline);
|
|
16
|
+
|
|
17
|
+
# unicode in raw strings
|
|
18
|
+
raw_unicode = r"Raw string with ✓ and ○";
|
|
19
|
+
print(raw_unicode);
|
|
20
|
+
|
|
21
|
+
# mixed unicode and escape sequences
|
|
22
|
+
mixed = "Tab ✓\nNewline ○";
|
|
23
|
+
print(mixed);
|
|
24
|
+
}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import from bar { bar_walk }
|
|
2
|
-
import from jaclang.runtimelib.machine {
|
|
1
|
+
import from bar { bar_walk }
|
|
2
|
+
import from jaclang.runtimelib.machine { JacMachine }
|
|
3
3
|
import os;
|
|
4
4
|
|
|
5
|
+
|
|
5
6
|
def update_bar_walker {
|
|
6
7
|
"Updating bar.jac with new behavior." |> print;
|
|
7
|
-
(bar_walk_new,
|
|
8
|
-
"bar",
|
|
9
|
-
items={'bar_walk': None}
|
|
10
|
-
);
|
|
8
|
+
(bar_walk_new,) = JacMachine.update_walker("bar", items={'bar_walk' : None });
|
|
11
9
|
"Running bar_walk after update..." |> print;
|
|
12
10
|
root spawn bar_walk_new();
|
|
13
11
|
print(f"bar_walk: {bar_walk_new.__dict__}");
|
|
@@ -16,4 +14,4 @@ def update_bar_walker {
|
|
|
16
14
|
|
|
17
15
|
with entry {
|
|
18
16
|
update_bar_walker();
|
|
19
|
-
}
|
|
17
|
+
}
|