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
@@ -0,0 +1,21 @@
1
+ node MyNode{
2
+ has val:int;
3
+
4
+ can ability1 with MyWalker entry {
5
+ print("Visitor name is ",visitor.name);
6
+ }
7
+ }
8
+
9
+ walker MyWalker{
10
+ has name:str;
11
+
12
+ can ability2 with MyNode entry {
13
+ print("Here value is ",here.val);
14
+ }
15
+ }
16
+
17
+ with entry {
18
+ Node1 = MyNode(10);
19
+ Walker1 = MyWalker("Walker 1");
20
+ Walker1 spawn Node1;
21
+ }
@@ -2,48 +2,44 @@ node person {
2
2
  has age: int;
3
3
  }
4
4
 
5
- with entry {
6
- p1 = person(10); p5 = person(50);
7
- p2 = person(20); p6 = person(60);
8
- p3 = person(30); p7 = person(70);
9
- p4 = person(40); p8 = person(80);
10
5
 
11
- root ++> p1++> p2++> p3++> p4;
12
- root ++> p5++> p6++> p7++> p8;
6
+ with entry {
7
+ p1 = person(10);
8
+ p5 = person(50);
9
+ p2 = person(20);
10
+ p6 = person(60);
11
+ p3 = person(30);
12
+ p7 = person(70);
13
+ p4 = person(40);
14
+ p8 = person(80);
15
+ root ++> p1 ++> p2 ++> p3 ++> p4;
16
+ root ++> p5 ++> p6 ++> p7 ++> p8;
13
17
  p4 ++> p8;
14
-
15
18
  # # before deletion
16
- a = dotgen(root);
17
- assert a.count('label=""]') == 9;
18
- assert a.count('[label="person(') == 8;
19
-
19
+ a = printgraph(root);
20
+ assert a.count('label=""]') == 9 ;
21
+ assert a.count('[label="person(') == 8 ;
20
22
  # # delete p2
21
- del p2;
22
- b = dotgen(root);
23
- assert b.count('label="person') == 7;
24
- assert 'age=20' not in b;
25
-
23
+ del p2 ;
24
+ b = printgraph(root);
25
+ assert b.count('label="person') == 7 ;
26
+ assert 'age=20' not in b ;
26
27
  # doublecheck p3 also doesnot attach to it
27
- c = dotgen(p3);
28
- assert c.count('label="person') == 7;
29
- assert 'age=20' not in c;
30
-
31
-
28
+ c = printgraph(p3);
29
+ assert c.count('label="person') == 7 ;
30
+ assert 'age=20' not in c ;
32
31
  # # del multiple nodes
33
- del [p1, p4];
34
- d = dotgen(root);
35
- assert d.count('label="person') == 4;
36
- for i in [10, 20, 30, 40 ]{
37
- assert f'age={i}' not in d;
32
+ del [p1, p4] ;
33
+ d = printgraph(root);
34
+ assert d.count('label="person') == 4 ;
35
+ for i in [10, 20, 30, 40] {
36
+ assert f'age={i}' not in d ;
38
37
  }
39
-
40
-
41
- apple_list = [1, 2, 3, 4, 5,6,7,8,9,10];
42
- del apple_list[0];
38
+ apple_list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
39
+ del apple_list[0] ;
43
40
  print('apple list after delete 0 :', apple_list);
44
- del [apple_list[6], apple_list[7]];
41
+ del [apple_list[6], apple_list[7]] ;
45
42
  print('apple list after delete 7, 8 :', apple_list);
46
-
47
43
  obj Inner {
48
44
  has c: list;
49
45
  has d: int;
@@ -52,9 +48,7 @@ with entry {
52
48
  has b: Inner;
53
49
  }
54
50
  a = Outer(b=Inner(c=[1, 2, 3], d=4));
55
-
56
51
  print('a.b before delete :', a.b);
57
- del a.b.c[1];
52
+ del a.b.c[1] ;
58
53
  print('a.b after delete :', a.b);
59
-
60
54
  }
@@ -0,0 +1,47 @@
1
+ node MyNode {
2
+ has val:int;
3
+
4
+ can do with MyWalker entry {
5
+ print( visitor,"from node", self);
6
+ }
7
+ }
8
+
9
+ edge MyEdge {
10
+ has path:int;
11
+
12
+ can do with MyWalker entry {
13
+ print(visitor,"from edge",self);
14
+ }
15
+ }
16
+
17
+ walker MyWalker {
18
+ can does with MyNode entry {
19
+ if here.val == 20{
20
+ visit :0:[-->];
21
+ }
22
+ elif here.val == 30 {
23
+ visit :-1:[-->];
24
+ }
25
+ elif here.val == 40 {
26
+ visit :-8:[-->]; # test out of index
27
+ }
28
+ else {
29
+ visit [-->];
30
+ }
31
+
32
+ }
33
+ }
34
+
35
+ with entry {
36
+ n0 = MyNode(0);
37
+ n1 = MyNode(10);
38
+ n2 = MyNode(20);
39
+ n3 = MyNode(30);
40
+ n4 = MyNode(40);
41
+ root ++> n0 ++> n1;
42
+ n1 ++> [n2, n3, n4, MyNode(45)];
43
+ n2 ++> [MyNode(50), MyNode(60)];
44
+ n3 ++> MyNode(70);
45
+ n4 ++> MyNode(90);
46
+ MyWalker() spawn n0;
47
+ }
jaclang/tests/test_cli.py CHANGED
@@ -11,7 +11,7 @@ import traceback
11
11
  import unittest
12
12
  from jaclang.cli import cli
13
13
  from jaclang.cli.cmdreg import cmd_registry, extract_param_descriptions
14
- from jaclang.runtimelib.builtin import dotgen
14
+ from jaclang.runtimelib.builtin import printgraph
15
15
  from jaclang.utils.test import TestCase
16
16
 
17
17
 
@@ -190,7 +190,7 @@ class JacCliTests(TestCase):
190
190
  r"13\:12 \- 13\:18.*Name - append - .*SymbolPath: builtins.list.append",
191
191
  )
192
192
 
193
- def test_ast_dotgen(self) -> None:
193
+ def test_ast_printgraph(self) -> None:
194
194
  """Testing for print AstTool."""
195
195
  captured_output = io.StringIO()
196
196
  sys.stdout = captured_output
@@ -293,11 +293,16 @@ class JacCliTests(TestCase):
293
293
  def test_graph_coverage(self) -> None:
294
294
  """Test for coverage of graph cmd."""
295
295
  graph_params = set(inspect.signature(cli.dot).parameters.keys())
296
- dotgen_params = set(inspect.signature(dotgen).parameters.keys())
297
- dotgen_params = dotgen_params - {"node", "dot_file", "edge_type", "as_json"}
298
- dotgen_params.update({"initial", "saveto", "connection", "session"})
299
- self.assertTrue(dotgen_params.issubset(graph_params))
300
- self.assertEqual(len(dotgen_params) + 1, len(graph_params))
296
+ printgraph_params = set(inspect.signature(printgraph).parameters.keys())
297
+ printgraph_params = printgraph_params - {
298
+ "node",
299
+ "file",
300
+ "edge_type",
301
+ "format",
302
+ }
303
+ printgraph_params.update({"initial", "saveto", "connection", "session"})
304
+ self.assertTrue(printgraph_params.issubset(graph_params))
305
+ self.assertEqual(len(printgraph_params) + 1, len(graph_params))
301
306
 
302
307
  def test_graph(self) -> None:
303
308
  """Test for graph CLI cmd."""
@@ -108,14 +108,14 @@ class JacLanguageTests(TestCase):
108
108
  "Too high!\nToo low!\nToo high!\nCongratulations! You guessed correctly.\n",
109
109
  )
110
110
 
111
- def test_dotgen(self) -> None:
111
+ def test_printgraph(self) -> None:
112
112
  """Test the dot gen of builtin function."""
113
113
  import json
114
114
 
115
115
  captured_output = io.StringIO()
116
116
  sys.stdout = captured_output
117
117
  Jac.jac_import(
118
- self.mach, "builtin_dotgen_json", base_path=self.fixture_abs_path("./")
118
+ self.mach, "builtin_printgraph_json", base_path=self.fixture_abs_path("./")
119
119
  )
120
120
  sys.stdout = sys.__stdout__
121
121
  stdout_value = captured_output.getvalue()
@@ -130,6 +130,19 @@ class JacLanguageTests(TestCase):
130
130
  edges = data["edges"]
131
131
  self.assertEqual(len(edges), 6)
132
132
 
133
+ def test_printgraph_mermaid(self) -> None:
134
+ """Test the mermaid gen of builtin function."""
135
+ captured_output = io.StringIO()
136
+ sys.stdout = captured_output
137
+ Jac.jac_import(
138
+ self.mach,
139
+ "builtin_printgraph_mermaid",
140
+ base_path=self.fixture_abs_path("./"),
141
+ )
142
+ sys.stdout = sys.__stdout__
143
+ stdout_value = captured_output.getvalue()
144
+ self.assertIn("flowchart LR", stdout_value)
145
+
133
146
  def test_chandra_bugs(self) -> None:
134
147
  """Parse micro jac file."""
135
148
  captured_output = io.StringIO()
@@ -155,7 +168,7 @@ class JacLanguageTests(TestCase):
155
168
  stdout_value,
156
169
  "{'apple': None, 'pineapple': None}\n"
157
170
  "This is a long\n"
158
- " line of code.\n"
171
+ " line of code.\n"
159
172
  "{'a': 'apple', 'b': 'ball', 'c': 'cat', 'd': 'dog', 'e': 'elephant'}\n",
160
173
  )
161
174
 
@@ -281,7 +294,7 @@ class JacLanguageTests(TestCase):
281
294
 
282
295
  def test_deep_imports_interp_mode(self) -> None:
283
296
  """Parse micro jac file."""
284
- mach = JacMachine(self.fixture_abs_path("./"), interp_mode=True)
297
+ mach = JacMachine(self.fixture_abs_path("./"))
285
298
  Jac.attach_program(
286
299
  mach,
287
300
  JacProgram(),
@@ -289,18 +302,17 @@ class JacLanguageTests(TestCase):
289
302
  Jac.jac_import(
290
303
  mach, "deep_import_interp", base_path=self.fixture_abs_path("./")
291
304
  )
292
- print(mach.jac_program.mod.hub.keys())
293
- self.assertEqual(len(mach.jac_program.mod.hub.keys()), 1)
294
- mach = JacMachine(self.fixture_abs_path("./"), interp_mode=False)
305
+ self.assertEqual(len(mach.program.mod.hub.keys()), 1)
306
+ mach = JacMachine(self.fixture_abs_path("./"))
295
307
  Jac.attach_program(
296
308
  mach,
297
- JacProgram(),
309
+ (prog := JacProgram()),
298
310
  )
311
+ prog.compile(self.fixture_abs_path("./deep_import_interp.jac"))
299
312
  Jac.jac_import(
300
313
  mach, "deep_import_interp", base_path=self.fixture_abs_path("./")
301
314
  )
302
- print(mach.jac_program.mod.hub.keys())
303
- self.assertEqual(len(mach.jac_program.mod.hub.keys()), 5)
315
+ self.assertEqual(len(mach.program.mod.hub.keys()), 5)
304
316
 
305
317
  def test_deep_imports_mods(self) -> None:
306
318
  """Parse micro jac file."""
@@ -439,7 +451,7 @@ class JacLanguageTests(TestCase):
439
451
  captured_output = io.StringIO()
440
452
  sys.stdout = captured_output
441
453
  Jac.jac_import(
442
- self.mach, "builtin_dotgen", base_path=self.fixture_abs_path("./")
454
+ self.mach, "builtin_printgraph", base_path=self.fixture_abs_path("./")
443
455
  )
444
456
  sys.stdout = sys.__stdout__
445
457
  stdout_value = captured_output.getvalue()
@@ -553,8 +565,10 @@ class JacLanguageTests(TestCase):
553
565
  ).ir_out.unparse()
554
566
  self.assertIn("class X {\n with entry {\n a_b = 67;", output)
555
567
  self.assertIn("br = b'Hello\\\\\\\\nWorld'", output)
556
- self.assertIn("class Circle {\n def init(radius: float", output)
557
- self.assertIn("<>node = 90;\n \n\n print(<>node);\n", output)
568
+ self.assertIn(
569
+ "class Circle {\n def init(self: Circle, radius: float", output
570
+ )
571
+ self.assertIn("<>node = 90;\n print(<>node);\n", output)
558
572
 
559
573
  def test_pyfunc_3(self) -> None:
560
574
  """Test py ast to Jac ast conversion."""
@@ -574,7 +588,7 @@ class JacLanguageTests(TestCase):
574
588
  ).ir_out.unparse()
575
589
  self.assertIn("if (0 <= x <= 5) {", output)
576
590
  self.assertIn(" case _:\n", output)
577
- self.assertIn(" case Point ( x = int ( a ), y = 0 ):\n", output)
591
+ self.assertIn(" case Point(x = int(a), y = 0):\n", output)
578
592
  self.assertIn("class Sample {\n def init", output)
579
593
 
580
594
  def test_py2jac(self) -> None:
@@ -594,8 +608,8 @@ class JacLanguageTests(TestCase):
594
608
  prog=None,
595
609
  ).ir_out.unparse()
596
610
  self.assertIn("match Container(inner=Inner(x=a, y=b)) { \n", output)
597
- self.assertIn("case Container ( inner = Inner ( x = a, y = 0 ) ):\n", output)
598
- self.assertIn("case Container ( inner = Inner ( x = a, y = b ) ):\n", output)
611
+ self.assertIn("case Container(inner = Inner(x = a, y = 0)):\n", output)
612
+ self.assertIn("case Container(inner = Inner(x = a, y = b)):\n", output)
599
613
  self.assertIn("case _:\n", output)
600
614
 
601
615
  def test_refs_target(self) -> None:
@@ -1267,3 +1281,64 @@ class JacLanguageTests(TestCase):
1267
1281
  self.assertIn("(tok[ 0 ] > change_end_line)", output)
1268
1282
  self.assertIn("(tok[ 0 ] == change_end_line)", output)
1269
1283
  self.assertIn("(tok[ 1 ] > change_end_char)", output)
1284
+
1285
+ def test_here_visitor_usage(self) -> None:
1286
+ """Test visitor, here keyword usage in jaclang."""
1287
+ captured_output = io.StringIO()
1288
+ sys.stdout = captured_output
1289
+ Jac.jac_import(
1290
+ self.mach, "here_visitor_usage", base_path=self.fixture_abs_path("./")
1291
+ )
1292
+ sys.stdout = sys.__stdout__
1293
+ stdout_value = captured_output.getvalue().split("\n")
1294
+ self.assertIn("Here value is 10", stdout_value[0])
1295
+ self.assertIn("Visitor name is Walker 1", stdout_value[1])
1296
+
1297
+ def test_here_visitor_error(self) -> None:
1298
+ """Test visitor, here keyword usage in jaclang."""
1299
+ captured_output = io.StringIO()
1300
+ sys.stdout = captured_output
1301
+ sys.stderr = captured_output
1302
+ cli.run(self.fixture_abs_path("here_usage_error.jac"))
1303
+ sys.stdout = sys.__stdout__
1304
+ sys.stderr = sys.__stderr__
1305
+ stdout_value = captured_output.getvalue()
1306
+ self.assertIn("'here' is not defined", stdout_value)
1307
+
1308
+ def test_edge_ability(self) -> None:
1309
+ """Test visitor, here keyword usage in jaclang."""
1310
+ captured_output = io.StringIO()
1311
+ sys.stdout = captured_output
1312
+ cli.run(self.fixture_abs_path("edge_ability.jac"))
1313
+ sys.stdout = sys.__stdout__
1314
+ stdout_value = captured_output.getvalue().split("\n")
1315
+ self.assertIn("MyEdge from walker MyEdge(path=1)", stdout_value[0])
1316
+ self.assertIn("MyWalker from edge MyWalker()", stdout_value[1])
1317
+ self.assertIn("MyWalker from node MyWalker()", stdout_value[6])
1318
+ self.assertIn("MyEdge from walker MyEdge(path=2)", stdout_value[16])
1319
+
1320
+ def test_backward_edge_visit(self) -> None:
1321
+ """Test backward edge visit in jaclang."""
1322
+ captured_output = io.StringIO()
1323
+ sys.stdout = captured_output
1324
+ cli.run(self.fixture_abs_path("backward_edge_visit.jac"))
1325
+ sys.stdout = sys.__stdout__
1326
+ stdout_value = captured_output.getvalue().split("\n")
1327
+ self.assertIn("MyWalker() from node MyNode(val=0)", stdout_value[0])
1328
+ self.assertIn("MyWalker() from edge MyEdge(path=0)", stdout_value[1])
1329
+ self.assertIn("MyWalker() from edge MyEdge(path=3)", stdout_value[6])
1330
+ self.assertIn("MyWalker() from node MyNode(val=40)", stdout_value[9])
1331
+
1332
+ def test_visit_traversal(self) -> None:
1333
+ """Test visit traversal semantic in jaclang."""
1334
+ captured_output = io.StringIO()
1335
+ sys.stdout = captured_output
1336
+ cli.run(self.fixture_abs_path("visit_traversal.jac"))
1337
+ sys.stdout = sys.__stdout__
1338
+ stdout_value = captured_output.getvalue().split("\n")
1339
+ self.assertIn("MyWalker() from node MyNode(val=0)", stdout_value[0])
1340
+ self.assertIn("MyWalker() from node MyNode(val=20)", stdout_value[2])
1341
+ self.assertIn("MyWalker() from node MyNode(val=60)", stdout_value[4])
1342
+ self.assertIn("MyWalker() from node MyNode(val=40)", stdout_value[6])
1343
+ self.assertIn("MyWalker() from node MyNode(val=90)", stdout_value[7])
1344
+ self.assertIn("MyWalker() from node MyNode(val=70)", stdout_value[9])
jaclang/utils/helpers.py CHANGED
@@ -99,12 +99,20 @@ def auto_generate_refs() -> str:
99
99
  heading = heading.strip()
100
100
  heading_snakecase = heading_to_snake(heading)
101
101
  content = (
102
- f'## {heading}\n**Code Example**\n=== "Jac"\n ```jac linenums="1"\n --8<-- "jac/examples/reference/'
103
- f'{heading_snakecase}.jac"\n'
104
- f' ```\n=== "Python"\n ```python linenums="1"\n --8<-- "jac/examples/reference/'
105
- f'{heading_snakecase}.py"\n ```\n'
106
- f'??? example "Jac Grammar Snippet"\n ```yaml linenums="{lines[0]}"\n --8<-- '
107
- f'"jaclang/compiler/jac.lark:{lines[0]}:{lines[1]}"\n ```\n'
102
+ f'## {heading}\n**Code Example**\n!!! example "Runnable Example in Jac and JacLib"\n'
103
+ ' === "Try it!"\n <div class="code-block">\n'
104
+ " ```jac\n"
105
+ f' --8<-- "jac/examples/reference/{heading_snakecase}.jac"\n'
106
+ " ```\n"
107
+ " </div>\n"
108
+ ' === "Jac"\n ```jac linenums="1"\n'
109
+ f' --8<-- "jac/examples/reference/{heading_snakecase}.jac"\n'
110
+ f' ```\n === "Python"\n'
111
+ ' ```python linenums="1"\n'
112
+ ' --8<-- "jac/examples/reference/'
113
+ f'{heading_snakecase}.py"\n ```\n'
114
+ f'??? info "Jac Grammar Snippet"\n ```yaml linenums="{lines[0]}"\n --8<-- '
115
+ f'"jac/jaclang/compiler/jac.lark:{lines[0]}:{lines[1]}"\n ```\n'
108
116
  "**Description**\n\n--8<-- "
109
117
  f'"jac/examples/reference/'
110
118
  f'{heading_snakecase}.md"\n'
@@ -229,7 +229,7 @@ class AstTool:
229
229
  return out
230
230
  case "sym.":
231
231
  return (
232
- ir.sym_tab.sym_dotgen()
232
+ ir.sym_tab.sym_printgraph()
233
233
  if isinstance(ir.sym_tab, UniScopeNode)
234
234
  else "Sym_tab is None."
235
235
  )
@@ -241,7 +241,7 @@ class AstTool:
241
241
  out += f"##{t}##\n# {mod_name} #\n##{t}##\n{module_.pp()}\n"
242
242
  return out
243
243
  case "ast.":
244
- return ir.dotgen()
244
+ return ir.printgraph()
245
245
  case "unparse":
246
246
  return ir.unparse()
247
247
  case "pyast":
@@ -277,7 +277,6 @@ class AstTool:
277
277
  arrow = "-.->" if "Optional" in kid.typ else "-->"
278
278
  typ = (
279
279
  kid.typ.replace("Optional[", "")
280
- .replace("SubNodeList[", "")
281
280
  .replace("SubTag[", "")
282
281
  .replace("Sequence[", "")
283
282
  .replace("]", "")
@@ -21,7 +21,8 @@ class JacAstToolTests(TestCase):
21
21
  out = self.tool.pass_template()
22
22
  self.assertIn("target: Expr,", out)
23
23
  self.assertIn("self, node: ast.ReturnStmt", out)
24
- self.assertIn("exprs: SubNodeList[ExprAsItem],", out)
24
+ self.assertIn("exprs: Sequence[ExprAsItem],", out)
25
+ self.assertIn("path: Optional[Sequence[Name]],", out)
25
26
  self.assertIn("value: str,", out)
26
27
  self.assertIn("def exit_module(self, node: ast.Module)", out)
27
28
  self.assertGreater(out.count("def exit_"), 20)
@@ -28,7 +28,6 @@ CLASS_COLOR_MAP: dict[str, str] = {
28
28
  "ArchSpec": "#a3d3f0",
29
29
  "MatchPattern": "#a0d8b3",
30
30
  "SubTag": "#cafafa",
31
- "SubNodeList": "#dbbfe5",
32
31
  "Module": "#D1FFE2 ",
33
32
  "GlobalVars": "#e1d1ff",
34
33
  "Test": "#e1d1ff",
@@ -136,7 +135,7 @@ CLASS_COLOR_MAP: dict[str, str] = {
136
135
  }
137
136
 
138
137
 
139
- def dotgen_ast_tree(
138
+ def printgraph_ast_tree(
140
139
  root: UniNode,
141
140
  dot_lines: Optional[list[str]] = None,
142
141
  ) -> str:
@@ -184,7 +183,7 @@ def dotgen_ast_tree(
184
183
  dot_lines.append(f"{gen_node_id(root)} {gen_node_parameters(root)};")
185
184
  for i in root.kid:
186
185
  dot_lines.append(f"{gen_node_id(root)} -> {gen_node_id(i)};")
187
- dotgen_ast_tree(i, dot_lines)
186
+ printgraph_ast_tree(i, dot_lines)
188
187
  if starting_call:
189
188
  return "\ndigraph graph1 {\n" + "\n".join(list(set(dot_lines))) + "\n}"
190
189
  return " "
@@ -502,7 +501,7 @@ def get_symtab_tree_str(
502
501
  )
503
502
 
504
503
 
505
- def dotgen_symtab_tree(node: UniScopeNode) -> str:
504
+ def printgraph_symtab_tree(node: UniScopeNode) -> str:
506
505
  """Generate DOT graph representation of a symbol table tree."""
507
506
  dot_lines = []
508
507
  id_map = {}
@@ -1,8 +1,7 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: jaclang
3
- Version: 0.8.0
3
+ Version: 0.8.1
4
4
  Summary: Jac is a unique and powerful programming language that runs on top of Python, offering an unprecedented level of intelligence and intuitive understanding.
5
- Home-page: https://jaseci.org
6
5
  License: MIT
7
6
  Keywords: jac,jaclang,jaseci,python,programming-language,machine-learning,artificial-intelligence
8
7
  Author: Jason Mars
@@ -14,11 +13,13 @@ Classifier: License :: OSI Approved :: MIT License
14
13
  Classifier: Programming Language :: Python :: 3
15
14
  Classifier: Programming Language :: Python :: 3.11
16
15
  Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
17
  Provides-Extra: all
18
18
  Provides-Extra: llm
19
19
  Provides-Extra: streamlit
20
20
  Requires-Dist: mypy (>=1.15.0,<2.0.0)
21
21
  Project-URL: Documentation, https://jac-lang.org
22
+ Project-URL: Homepage, https://jaseci.org
22
23
  Project-URL: Repository, https://github.com/Jaseci-Labs/jaclang
23
24
  Description-Content-Type: text/markdown
24
25