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.

Files changed (77) hide show
  1. jaclang/__init__.py +6 -0
  2. jaclang/cli/cli.py +21 -50
  3. jaclang/compiler/codeinfo.py +0 -1
  4. jaclang/compiler/jac.lark +12 -10
  5. jaclang/compiler/larkparse/jac_parser.py +2 -2
  6. jaclang/compiler/parser.py +18 -10
  7. jaclang/compiler/passes/main/__init__.py +0 -14
  8. jaclang/compiler/passes/main/annex_pass.py +2 -8
  9. jaclang/compiler/passes/main/cfg_build_pass.py +38 -12
  10. jaclang/compiler/passes/main/import_pass.py +3 -11
  11. jaclang/compiler/passes/main/pyast_gen_pass.py +243 -592
  12. jaclang/compiler/passes/main/sym_tab_link_pass.py +2 -5
  13. jaclang/compiler/passes/main/tests/test_cfg_build_pass.py +2 -8
  14. jaclang/compiler/passes/main/tests/test_decl_impl_match_pass.py +7 -8
  15. jaclang/compiler/passes/main/tests/test_import_pass.py +5 -18
  16. jaclang/compiler/passes/main/tests/test_pyast_gen_pass.py +2 -6
  17. jaclang/compiler/passes/main/tests/test_sub_node_pass.py +1 -3
  18. jaclang/compiler/passes/main/tests/test_sym_tab_link_pass.py +20 -17
  19. jaclang/compiler/passes/tool/doc_ir_gen_pass.py +237 -105
  20. jaclang/compiler/passes/tool/jac_formatter_pass.py +2 -0
  21. jaclang/compiler/passes/tool/tests/fixtures/archetype_frmt.jac +14 -0
  22. jaclang/compiler/passes/tool/tests/fixtures/general_format_checks/triple_quoted_string.jac +5 -4
  23. jaclang/compiler/passes/tool/tests/fixtures/import_fmt.jac +6 -0
  24. jaclang/compiler/passes/tool/tests/fixtures/simple_walk_fmt.jac +3 -3
  25. jaclang/compiler/passes/tool/tests/fixtures/tagbreak.jac +9 -0
  26. jaclang/compiler/passes/tool/tests/test_jac_format_pass.py +18 -3
  27. jaclang/compiler/passes/tool/tests/test_unparse_validate.py +2 -2
  28. jaclang/compiler/program.py +21 -60
  29. jaclang/compiler/tests/fixtures/pkg_import_lib_py/__init__.py +2 -8
  30. jaclang/compiler/tests/fixtures/pkg_import_lib_py/sub/__init__.py +1 -5
  31. jaclang/compiler/tests/test_importer.py +10 -13
  32. jaclang/compiler/unitree.py +32 -16
  33. jaclang/langserve/__init__.jac +1 -1
  34. jaclang/langserve/engine.jac +113 -108
  35. jaclang/langserve/server.jac +17 -2
  36. jaclang/langserve/tests/server_test/test_lang_serve.py +138 -46
  37. jaclang/langserve/tests/server_test/utils.py +35 -9
  38. jaclang/langserve/tests/test_sem_tokens.py +1 -1
  39. jaclang/langserve/tests/test_server.py +3 -7
  40. jaclang/runtimelib/archetype.py +127 -5
  41. jaclang/runtimelib/importer.py +51 -94
  42. jaclang/runtimelib/machine.py +391 -268
  43. jaclang/runtimelib/meta_importer.py +86 -0
  44. jaclang/runtimelib/tests/fixtures/graph_purger.jac +24 -26
  45. jaclang/runtimelib/tests/fixtures/other_root_access.jac +25 -16
  46. jaclang/runtimelib/tests/test_jaseci.py +3 -1
  47. jaclang/tests/fixtures/arch_rel_import_creation.jac +23 -23
  48. jaclang/tests/fixtures/async_ability.jac +43 -10
  49. jaclang/tests/fixtures/async_function.jac +18 -0
  50. jaclang/tests/fixtures/async_walker.jac +17 -12
  51. jaclang/tests/fixtures/create_dynamic_archetype.jac +25 -28
  52. jaclang/tests/fixtures/deep/deeper/deep_outer_import.jac +7 -4
  53. jaclang/tests/fixtures/deep/deeper/snd_lev.jac +2 -2
  54. jaclang/tests/fixtures/deep/deeper/snd_lev_dup.jac +6 -0
  55. jaclang/tests/fixtures/deep/one_lev.jac +2 -2
  56. jaclang/tests/fixtures/deep/one_lev_dup.jac +4 -3
  57. jaclang/tests/fixtures/dynamic_archetype.jac +19 -12
  58. jaclang/tests/fixtures/foo.jac +14 -22
  59. jaclang/tests/fixtures/jac_from_py.py +1 -1
  60. jaclang/tests/fixtures/jp_importer.jac +6 -6
  61. jaclang/tests/fixtures/jp_importer_auto.jac +5 -3
  62. jaclang/tests/fixtures/unicode_strings.jac +24 -0
  63. jaclang/tests/fixtures/walker_update.jac +5 -7
  64. jaclang/tests/test_language.py +138 -140
  65. jaclang/tests/test_reference.py +9 -4
  66. jaclang/tests/test_typecheck.py +13 -26
  67. jaclang/utils/lang_tools.py +7 -5
  68. jaclang/utils/module_resolver.py +23 -0
  69. {jaclang-0.8.1.dist-info → jaclang-0.8.2.dist-info}/METADATA +1 -1
  70. {jaclang-0.8.1.dist-info → jaclang-0.8.2.dist-info}/RECORD +72 -70
  71. jaclang/compiler/passes/main/tests/fixtures/main_err.jac +0 -6
  72. jaclang/compiler/passes/main/tests/fixtures/second_err.jac +0 -4
  73. jaclang/compiler/passes/tool/tests/fixtures/corelib.jac +0 -644
  74. jaclang/compiler/passes/tool/tests/test_doc_ir_gen_pass.py +0 -29
  75. jaclang/tests/fixtures/deep/deeper/__init__.jac +0 -1
  76. {jaclang-0.8.1.dist-info → jaclang-0.8.2.dist-info}/WHEEL +0 -0
  77. {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 {JacMachineInterface, JacMachine}
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
- walker child_walker(test_walker) {}
20
+
21
+ walker child_walker ( test_walker ) {}
22
+
19
23
 
20
24
  with entry {
21
- for value in range(1, 4) {
22
- root ++> test_node(value=value);
23
- root ++> Item(value=value);
24
- }
25
- node_obj = JacMachineInterface.spawn_node(JacMachineInterface.py_get_jac_machine(), node_name='test_node', attributes={'value': 0}, module_name='__main__');
26
- walker_obj = JacMachineInterface.spawn_walker(JacMachineInterface.py_get_jac_machine(), walker_name='child_walker', module_name='__main__');
27
- external_node = JacMachineInterface.spawn_node(JacMachineInterface.py_get_jac_machine(), node_name='Item', attributes={'value': 0}, module_name='bar');
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);
@@ -1,42 +1,34 @@
1
- import from jaclang.runtimelib.machine { JacMachineInterface, JacMachine }
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
- modules = JacMachineInterface.list_modules(JacMachineInterface.py_get_jac_machine());
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
- walkers = JacMachineInterface.list_walkers(JacMachineInterface.py_get_jac_machine(), mod_name);
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
- nodes = JacMachineInterface.list_nodes(JacMachineInterface.py_get_jac_machine(), mod_name);
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
- edges = JacMachineInterface.list_edges(JacMachineInterface.py_get_jac_machine(), mod_name);
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
- with entry {
30
+
31
+ # Define the entry point to run the test
32
+ with entry {
41
33
  test_run();
42
34
  }
@@ -1,4 +1,4 @@
1
1
  from jaclang import JacMachine as Jac
2
2
 
3
- (mod,) = Jac.py_jac_import(target=".simple_walk", base_path=__file__)
3
+ (mod,) = Jac.jac_import(target=".simple_walk", base_path=__file__)
4
4
  mod.test_run()
@@ -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 ..test_cli { JacCliTests as Jac }
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 ..test_cli { JacCliTests as Jac }
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 { JacMachineInterface, JacMachine }
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, ) = JacMachineInterface.update_walker(JacMachineInterface.py_get_jac_machine(),
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
+ }