jaclang 0.8.0__py3-none-any.whl → 0.8.1__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/cli/cli.py +11 -9
  2. jaclang/compiler/jac.lark +2 -12
  3. jaclang/compiler/larkparse/jac_parser.py +1 -1
  4. jaclang/compiler/parser.py +360 -521
  5. jaclang/compiler/passes/main/cfg_build_pass.py +2 -2
  6. jaclang/compiler/passes/main/def_impl_match_pass.py +14 -13
  7. jaclang/compiler/passes/main/def_use_pass.py +4 -7
  8. jaclang/compiler/passes/main/import_pass.py +3 -3
  9. jaclang/compiler/passes/main/inheritance_pass.py +2 -2
  10. jaclang/compiler/passes/main/pyast_gen_pass.py +196 -218
  11. jaclang/compiler/passes/main/pyast_load_pass.py +115 -311
  12. jaclang/compiler/passes/main/pyjac_ast_link_pass.py +8 -7
  13. jaclang/compiler/passes/main/sym_tab_build_pass.py +3 -3
  14. jaclang/compiler/passes/main/sym_tab_link_pass.py +4 -4
  15. jaclang/compiler/passes/main/tests/fixtures/symtab_link_tests/action/actions.jac +1 -5
  16. jaclang/compiler/passes/main/tests/fixtures/symtab_link_tests/main.jac +1 -8
  17. jaclang/compiler/passes/main/tests/test_cfg_build_pass.py +4 -2
  18. jaclang/compiler/passes/tool/doc_ir_gen_pass.py +197 -120
  19. jaclang/compiler/program.py +2 -7
  20. jaclang/compiler/tests/fixtures/fam.jac +2 -2
  21. jaclang/compiler/tests/fixtures/pkg_import_lib/__init__.jac +1 -0
  22. jaclang/compiler/tests/fixtures/pkg_import_lib/sub/__init__.jac +1 -0
  23. jaclang/compiler/tests/fixtures/pkg_import_lib/sub/helper.jac +3 -0
  24. jaclang/compiler/tests/fixtures/pkg_import_lib/tools.jac +3 -0
  25. jaclang/compiler/tests/fixtures/pkg_import_lib_py/__init__.py +11 -0
  26. jaclang/compiler/tests/fixtures/pkg_import_lib_py/sub/__init__.py +7 -0
  27. jaclang/compiler/tests/fixtures/pkg_import_lib_py/sub/helper.jac +3 -0
  28. jaclang/compiler/tests/fixtures/pkg_import_lib_py/tools.jac +3 -0
  29. jaclang/compiler/tests/fixtures/pkg_import_main.jac +10 -0
  30. jaclang/compiler/tests/fixtures/pkg_import_main_py.jac +11 -0
  31. jaclang/compiler/tests/test_importer.py +20 -0
  32. jaclang/compiler/tests/test_parser.py +1 -0
  33. jaclang/compiler/unitree.py +456 -304
  34. jaclang/langserve/engine.jac +498 -0
  35. jaclang/langserve/sem_manager.jac +309 -0
  36. jaclang/langserve/server.jac +186 -0
  37. jaclang/langserve/tests/server_test/test_lang_serve.py +6 -7
  38. jaclang/langserve/tests/server_test/utils.py +4 -1
  39. jaclang/langserve/tests/session.jac +294 -0
  40. jaclang/langserve/tests/test_sem_tokens.py +2 -2
  41. jaclang/langserve/tests/test_server.py +12 -7
  42. jaclang/langserve/utils.jac +51 -30
  43. jaclang/runtimelib/archetype.py +1 -1
  44. jaclang/runtimelib/builtin.py +17 -14
  45. jaclang/runtimelib/importer.py +26 -8
  46. jaclang/runtimelib/machine.py +96 -55
  47. jaclang/runtimelib/tests/fixtures/traversing_save.jac +7 -5
  48. jaclang/runtimelib/utils.py +3 -3
  49. jaclang/tests/fixtures/backward_edge_visit.jac +31 -0
  50. jaclang/tests/fixtures/builtin_printgraph.jac +85 -0
  51. jaclang/tests/fixtures/builtin_printgraph_json.jac +21 -0
  52. jaclang/tests/fixtures/builtin_printgraph_mermaid.jac +16 -0
  53. jaclang/tests/fixtures/chandra_bugs2.jac +20 -13
  54. jaclang/tests/fixtures/concurrency.jac +1 -1
  55. jaclang/tests/fixtures/edge_ability.jac +49 -0
  56. jaclang/tests/fixtures/guess_game.jac +1 -1
  57. jaclang/tests/fixtures/here_usage_error.jac +21 -0
  58. jaclang/tests/fixtures/here_visitor_usage.jac +21 -0
  59. jaclang/tests/fixtures/node_del.jac +30 -36
  60. jaclang/tests/fixtures/visit_traversal.jac +47 -0
  61. jaclang/tests/test_cli.py +12 -7
  62. jaclang/tests/test_language.py +91 -16
  63. jaclang/utils/helpers.py +14 -6
  64. jaclang/utils/lang_tools.py +2 -3
  65. jaclang/utils/tests/test_lang_tools.py +2 -1
  66. jaclang/utils/treeprinter.py +3 -4
  67. {jaclang-0.8.0.dist-info → jaclang-0.8.1.dist-info}/METADATA +4 -3
  68. {jaclang-0.8.0.dist-info → jaclang-0.8.1.dist-info}/RECORD +71 -55
  69. {jaclang-0.8.0.dist-info → jaclang-0.8.1.dist-info}/WHEEL +1 -1
  70. jaclang/langserve/engine.py +0 -553
  71. jaclang/langserve/sem_manager.py +0 -383
  72. jaclang/langserve/server.py +0 -167
  73. jaclang/langserve/tests/session.py +0 -255
  74. jaclang/tests/fixtures/builtin_dotgen.jac +0 -42
  75. jaclang/tests/fixtures/builtin_dotgen_json.jac +0 -21
  76. /jaclang/langserve/{__init__.py → __init__.jac} +0 -0
  77. {jaclang-0.8.0.dist-info → jaclang-0.8.1.dist-info}/entry_points.txt +0 -0
@@ -25,14 +25,14 @@ node location {
25
25
 
26
26
  for i in activities {
27
27
  i.duration = visitor.duration;
28
- if here.name not in visitor.passport {
28
+ if visitor.name not in visitor.passport {
29
29
  if i.name == "Hiking" {
30
30
  for j=0 to j<3 by j+=1 {
31
31
  i.duration+=1;
32
32
  }
33
33
  i.duration+=1;
34
34
  }
35
- visitor.passport.append(here.name);
35
+ visitor.passport.append(visitor.name);
36
36
  }
37
37
  }
38
38
  }
@@ -0,0 +1 @@
1
+ import from .tools { tool_func }
@@ -0,0 +1 @@
1
+ import from .helper { help_func }
@@ -0,0 +1,3 @@
1
+ def help_func() {
2
+ return 'Helper function called' ;
3
+ }
@@ -0,0 +1,3 @@
1
+ def tool_func() {
2
+ return 'Tool function executed' ;
3
+ }
@@ -0,0 +1,11 @@
1
+
2
+
3
+ from jaclang import JacMachineInterface as _
4
+
5
+ (tool_func,) = _.py_jac_import(
6
+ target="tools",
7
+ base_path=__file__,
8
+ items={"tool_func": None},
9
+ )
10
+
11
+ glob_var_lib = 'pkg_import_lib_py.glob_var_lib'
@@ -0,0 +1,7 @@
1
+ from jaclang import JacMachineInterface as _
2
+
3
+ (help_func,) = _.py_jac_import(
4
+ target=".helper",
5
+ base_path=__file__,
6
+ items={"help_func": None},
7
+ )
@@ -0,0 +1,3 @@
1
+ def help_func() {
2
+ return 'Helper function called' ;
3
+ }
@@ -0,0 +1,3 @@
1
+ def tool_func() {
2
+ return 'Tool function executed' ;
3
+ }
@@ -0,0 +1,10 @@
1
+ import from pkg_import_lib { tool_func }
2
+ import from pkg_import_lib.sub { help_func }
3
+
4
+ with entry {
5
+ print('Main Execution:\n') ;
6
+ print('Calling from tools.jac...') ;
7
+ print('Tool says:', tool_func()) ;
8
+ print('\nCalling from helper.jac...') ;
9
+ print('Helper says:', help_func()) ;
10
+ }
@@ -0,0 +1,11 @@
1
+ import from pkg_import_lib_py { tool_func,glob_var_lib }
2
+ import from pkg_import_lib_py.sub { help_func }
3
+
4
+ with entry {
5
+ print('Main Execution:\n') ;
6
+ print('Calling from tools.jac...') ;
7
+ print('Tool says:', tool_func()) ;
8
+ print('\nCalling from helper.jac...') ;
9
+ print('Helper says:', help_func()) ;
10
+ print('\nGlobal variable from lib:', glob_var_lib) ;
11
+ }
@@ -111,3 +111,23 @@ class TestLoader(TestCase):
111
111
 
112
112
  os.environ.pop("JACPATH", None)
113
113
  jacpath_dir.cleanup()
114
+
115
+ def test_importer_with_submodule_jac(self) -> None:
116
+ """Test basic self loading."""
117
+ captured_output = io.StringIO()
118
+ sys.stdout = captured_output
119
+ cli.run(self.fixture_abs_path("pkg_import_main.jac"))
120
+ sys.stdout = sys.__stdout__
121
+ stdout_value = captured_output.getvalue()
122
+ self.assertIn("Helper function called", stdout_value)
123
+ self.assertIn("Tool function executed", stdout_value)
124
+
125
+ def test_importer_with_submodule_py(self) -> None:
126
+ captured_output = io.StringIO()
127
+ sys.stdout = captured_output
128
+ cli.run(self.fixture_abs_path("pkg_import_main_py.jac"))
129
+ sys.stdout = sys.__stdout__
130
+ stdout_value = captured_output.getvalue()
131
+ self.assertIn("Helper function called", stdout_value)
132
+ self.assertIn("Tool function executed", stdout_value)
133
+ self.assertIn("pkg_import_lib_py.glob_var_lib", stdout_value)
@@ -111,6 +111,7 @@ class TestLarkParser(TestCaseMicroSuite):
111
111
  "consume_token",
112
112
  "match_many",
113
113
  "consume_many",
114
+ "extract_from_list",
114
115
  ]:
115
116
  continue
116
117
  self.assertIn(fn, rules)