jaclang 0.8.8__py3-none-any.whl → 0.8.9__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 (36) hide show
  1. jaclang/cli/cli.py +64 -2
  2. jaclang/compiler/constant.py +6 -1
  3. jaclang/compiler/jac.lark +34 -41
  4. jaclang/compiler/larkparse/jac_parser.py +2 -2
  5. jaclang/compiler/parser.py +143 -27
  6. jaclang/compiler/passes/main/def_use_pass.py +1 -0
  7. jaclang/compiler/passes/main/pyast_gen_pass.py +151 -83
  8. jaclang/compiler/passes/main/pyast_load_pass.py +2 -0
  9. jaclang/compiler/passes/main/tests/test_checker_pass.py +0 -1
  10. jaclang/compiler/passes/main/tests/test_predynamo_pass.py +13 -14
  11. jaclang/compiler/passes/tool/doc_ir_gen_pass.py +104 -20
  12. jaclang/compiler/passes/tool/jac_formatter_pass.py +2 -2
  13. jaclang/compiler/passes/tool/tests/fixtures/import_fmt.jac +7 -1
  14. jaclang/compiler/passes/tool/tests/fixtures/tagbreak.jac +135 -29
  15. jaclang/compiler/program.py +6 -2
  16. jaclang/compiler/type_system/type_evaluator.jac +959 -0
  17. jaclang/compiler/unitree.py +23 -13
  18. jaclang/lib.py +17 -0
  19. jaclang/runtimelib/archetype.py +25 -25
  20. jaclang/runtimelib/constructs.py +2 -2
  21. jaclang/runtimelib/machine.py +57 -47
  22. jaclang/settings.py +1 -2
  23. jaclang/tests/fixtures/attr_pattern_case.jac +18 -0
  24. jaclang/tests/fixtures/funccall_genexpr.jac +7 -0
  25. jaclang/tests/fixtures/funccall_genexpr.py +5 -0
  26. jaclang/tests/fixtures/py2jac_empty.py +0 -0
  27. jaclang/tests/test_cli.py +134 -18
  28. jaclang/tests/test_language.py +146 -29
  29. jaclang/tests/test_reference.py +3 -1
  30. jaclang/utils/helpers.py +20 -4
  31. jaclang/utils/tests/test_lang_tools.py +4 -15
  32. {jaclang-0.8.8.dist-info → jaclang-0.8.9.dist-info}/METADATA +1 -1
  33. {jaclang-0.8.8.dist-info → jaclang-0.8.9.dist-info}/RECORD +35 -30
  34. jaclang/compiler/type_system/type_evaluator.py +0 -844
  35. {jaclang-0.8.8.dist-info → jaclang-0.8.9.dist-info}/WHEEL +0 -0
  36. {jaclang-0.8.8.dist-info → jaclang-0.8.9.dist-info}/entry_points.txt +0 -0
@@ -2167,7 +2167,7 @@ class HasVar(AstSymbolNode, AstTypedVarNode):
2167
2167
  return res
2168
2168
 
2169
2169
 
2170
- class TypedCtxBlock(CodeBlockStmt, UniScopeNode):
2170
+ class TypedCtxBlock(CodeBlockStmt, WalkerStmtOnlyNode, UniScopeNode):
2171
2171
  """TypedCtxBlock node type for Jac Ast."""
2172
2172
 
2173
2173
  def __init__(
@@ -2181,6 +2181,7 @@ class TypedCtxBlock(CodeBlockStmt, UniScopeNode):
2181
2181
  UniNode.__init__(self, kid=kid)
2182
2182
  UniScopeNode.__init__(self, name=f"{self.__class__.__name__}")
2183
2183
  CodeBlockStmt.__init__(self)
2184
+ WalkerStmtOnlyNode.__init__(self)
2184
2185
 
2185
2186
  def normalize(self, deep: bool = False) -> bool:
2186
2187
  res = True
@@ -3229,13 +3230,21 @@ class FString(AtomExpr):
3229
3230
  for part in self.parts:
3230
3231
  res = res and part.normalize(deep)
3231
3232
  new_kid: list[UniNode] = []
3232
- is_single_quote = (
3233
- isinstance(self.kid[0], Token) and self.kid[0].name == Tok.FSTR_SQ_START
3234
- )
3235
- if is_single_quote:
3236
- new_kid.append(self.gen_token(Tok.FSTR_SQ_START))
3233
+ # Determine quote type from first token
3234
+ start_token = self.kid[0] if isinstance(self.kid[0], Token) else None
3235
+ if start_token:
3236
+ if start_token.name == Tok.FSTR_SQ_TRIPLE_START:
3237
+ start_tok, end_tok = Tok.FSTR_SQ_TRIPLE_START, Tok.FSTR_SQ_TRIPLE_END
3238
+ elif start_token.name == Tok.FSTR_TRIPLE_START:
3239
+ start_tok, end_tok = Tok.FSTR_TRIPLE_START, Tok.FSTR_TRIPLE_END
3240
+ elif start_token.name == Tok.FSTR_SQ_START:
3241
+ start_tok, end_tok = Tok.FSTR_SQ_START, Tok.FSTR_SQ_END
3242
+ else:
3243
+ start_tok, end_tok = Tok.FSTR_START, Tok.FSTR_END
3237
3244
  else:
3238
- new_kid.append(self.gen_token(Tok.FSTR_START))
3245
+ start_tok, end_tok = Tok.FSTR_START, Tok.FSTR_END
3246
+
3247
+ new_kid.append(self.gen_token(start_tok))
3239
3248
  for i in self.parts:
3240
3249
  if isinstance(i, String):
3241
3250
  i.value = (
@@ -3246,10 +3255,7 @@ class FString(AtomExpr):
3246
3255
  new_kid.append(self.gen_token(Tok.LBRACE))
3247
3256
  new_kid.append(i)
3248
3257
  new_kid.append(self.gen_token(Tok.RBRACE))
3249
- if is_single_quote:
3250
- new_kid.append(self.gen_token(Tok.FSTR_SQ_END))
3251
- else:
3252
- new_kid.append(self.gen_token(Tok.FSTR_END))
3258
+ new_kid.append(self.gen_token(end_tok))
3253
3259
  self.set_kids(nodes=new_kid)
3254
3260
  return res
3255
3261
 
@@ -3712,7 +3718,10 @@ class FuncCall(Expr):
3712
3718
  res = self.target.normalize(deep)
3713
3719
  for prm in self.params:
3714
3720
  res = res and prm.normalize(deep)
3715
- new_kids = [self.target, self.gen_token(Tok.LPAREN, "(")]
3721
+ new_kids: list[UniNode] = [self.target]
3722
+ is_gencompr = len(self.params) == 1 and isinstance(self.params[0], GenCompr)
3723
+ if not is_gencompr:
3724
+ new_kids.append(self.gen_token(Tok.LPAREN))
3716
3725
  for i, prm in enumerate(self.params):
3717
3726
  new_kids.append(prm)
3718
3727
  if i < len(self.params) - 1:
@@ -3720,7 +3729,8 @@ class FuncCall(Expr):
3720
3729
  if self.genai_call:
3721
3730
  new_kids.append(self.gen_token(Tok.KW_BY))
3722
3731
  new_kids.append(self.genai_call)
3723
- new_kids.append(self.gen_token(Tok.RPAREN, ")"))
3732
+ if not is_gencompr:
3733
+ new_kids.append(self.gen_token(Tok.RPAREN, ")"))
3724
3734
  self.set_kids(nodes=new_kids)
3725
3735
  return res
3726
3736
 
jaclang/lib.py ADDED
@@ -0,0 +1,17 @@
1
+ """Jac Library - User-friendly interface for library mode."""
2
+
3
+ from jaclang.runtimelib.machine import JacMachineInterface
4
+
5
+ # Automatically expose all public attributes from JacMachineInterface
6
+ # This includes archetype classes (Obj, Node, Edge, Walker, Root, Path) and all methods
7
+ _jac_interface_attrs = {
8
+ name: getattr(JacMachineInterface, name)
9
+ for name in dir(JacMachineInterface)
10
+ if not name.startswith("_")
11
+ }
12
+
13
+ # Add to module globals
14
+ globals().update(_jac_interface_attrs)
15
+
16
+ # Build __all__ with all JacMachineInterface exports
17
+ __all__ = sorted(_jac_interface_attrs.keys())
@@ -69,13 +69,13 @@ class AnchorReport:
69
69
  context: dict[str, Any]
70
70
 
71
71
 
72
- DataSpatialFilter: TypeAlias = (
72
+ ObjectSpatialFilter: TypeAlias = (
73
73
  Callable[["Archetype"], bool] | "Archetype" | list["Archetype"] | None
74
74
  )
75
75
 
76
76
 
77
77
  @dataclass(eq=False, repr=False)
78
- class DataSpatialDestination:
78
+ class ObjectSpatialDestination:
79
79
  """Object-Spatial Destination."""
80
80
 
81
81
  direction: EdgeDir
@@ -92,18 +92,18 @@ class DataSpatialDestination:
92
92
 
93
93
 
94
94
  @dataclass(eq=False, repr=False)
95
- class DataSpatialPath:
95
+ class ObjectSpatialPath:
96
96
  """Object-Spatial Path."""
97
97
 
98
98
  origin: list[NodeArchetype]
99
- destinations: list[DataSpatialDestination]
99
+ destinations: list[ObjectSpatialDestination]
100
100
  edge_only: bool
101
101
  from_visit: bool
102
102
 
103
103
  def __init__(
104
104
  self,
105
105
  origin: NodeArchetype | list[NodeArchetype],
106
- destinations: list[DataSpatialDestination] | None = None,
106
+ destinations: list[ObjectSpatialDestination] | None = None,
107
107
  ) -> None:
108
108
  """Override Init."""
109
109
  if not isinstance(origin, list):
@@ -115,7 +115,7 @@ class DataSpatialPath:
115
115
 
116
116
  def convert(
117
117
  self,
118
- filter: DataSpatialFilter,
118
+ filter: ObjectSpatialFilter,
119
119
  ) -> Callable[["Archetype"], bool] | None:
120
120
  """Convert filter."""
121
121
  if not filter:
@@ -129,44 +129,44 @@ class DataSpatialPath:
129
129
  def append(
130
130
  self,
131
131
  direction: EdgeDir,
132
- edge: DataSpatialFilter,
133
- node: DataSpatialFilter,
134
- ) -> DataSpatialPath:
132
+ edge: ObjectSpatialFilter,
133
+ node: ObjectSpatialFilter,
134
+ ) -> ObjectSpatialPath:
135
135
  """Append destination."""
136
136
  self.destinations.append(
137
- DataSpatialDestination(direction, self.convert(edge), self.convert(node))
137
+ ObjectSpatialDestination(direction, self.convert(edge), self.convert(node))
138
138
  )
139
139
  return self
140
140
 
141
- def _out(
142
- self, edge: DataSpatialFilter = None, node: DataSpatialFilter = None
143
- ) -> DataSpatialPath:
141
+ def edge_out(
142
+ self, edge: ObjectSpatialFilter = None, node: ObjectSpatialFilter = None
143
+ ) -> ObjectSpatialPath:
144
144
  """Override greater than function."""
145
145
  return self.append(EdgeDir.OUT, edge, node)
146
146
 
147
- def _in(
148
- self, edge: DataSpatialFilter = None, node: DataSpatialFilter = None
149
- ) -> DataSpatialPath:
147
+ def edge_in(
148
+ self, edge: ObjectSpatialFilter = None, node: ObjectSpatialFilter = None
149
+ ) -> ObjectSpatialPath:
150
150
  """Override greater than function."""
151
151
  return self.append(EdgeDir.IN, edge, node)
152
152
 
153
- def _any(
154
- self, edge: DataSpatialFilter = None, node: DataSpatialFilter = None
155
- ) -> DataSpatialPath:
153
+ def edge_any(
154
+ self, edge: ObjectSpatialFilter = None, node: ObjectSpatialFilter = None
155
+ ) -> ObjectSpatialPath:
156
156
  """Override greater than function."""
157
157
  return self.append(EdgeDir.ANY, edge, node)
158
158
 
159
- def edge(self) -> DataSpatialPath:
159
+ def edge(self) -> ObjectSpatialPath:
160
160
  """Set edge only."""
161
161
  self.edge_only = True
162
162
  return self
163
163
 
164
- def visit(self) -> DataSpatialPath:
164
+ def visit(self) -> ObjectSpatialPath:
165
165
  """Set from visit."""
166
166
  self.from_visit = True
167
167
  return self
168
168
 
169
- def repr_builder(self, repr: str, dest: DataSpatialDestination, mark: str) -> str:
169
+ def repr_builder(self, repr: str, dest: ObjectSpatialDestination, mark: str) -> str:
170
170
  """Repr builder."""
171
171
  repr += mark
172
172
  repr += f' (edge{" filter" if dest.edge else ""}) '
@@ -361,8 +361,8 @@ class ObjectAnchor(Anchor):
361
361
  class Archetype:
362
362
  """Archetype Protocol."""
363
363
 
364
- _jac_entry_funcs_: ClassVar[list[DataSpatialFunction]] = []
365
- _jac_exit_funcs_: ClassVar[list[DataSpatialFunction]] = []
364
+ _jac_entry_funcs_: ClassVar[list[ObjectSpatialFunction]] = []
365
+ _jac_exit_funcs_: ClassVar[list[ObjectSpatialFunction]] = []
366
366
 
367
367
  @cached_property
368
368
  def __jac__(self) -> Anchor:
@@ -454,7 +454,7 @@ class Root(NodeArchetype):
454
454
 
455
455
 
456
456
  @dataclass(eq=False)
457
- class DataSpatialFunction:
457
+ class ObjectSpatialFunction:
458
458
  """Object-Spatial Function."""
459
459
 
460
460
  name: str
@@ -7,12 +7,12 @@ from .archetype import (
7
7
  AccessLevel,
8
8
  Anchor,
9
9
  Archetype,
10
- DataSpatialFunction,
11
10
  EdgeAnchor,
12
11
  EdgeArchetype,
13
12
  GenericEdge,
14
13
  NodeAnchor,
15
14
  NodeArchetype,
15
+ ObjectSpatialFunction,
16
16
  Root,
17
17
  WalkerAnchor,
18
18
  WalkerArchetype,
@@ -32,7 +32,7 @@ __all__ = [
32
32
  "WalkerArchetype",
33
33
  "GenericEdge",
34
34
  "Root",
35
- "DataSpatialFunction",
35
+ "ObjectSpatialFunction",
36
36
  "Memory",
37
37
  "ShelfStorage",
38
38
  "JacTestResult",
@@ -34,10 +34,10 @@ from uuid import UUID
34
34
  from jaclang.compiler.constant import Constants as Con, EdgeDir, colors
35
35
  from jaclang.compiler.program import JacProgram
36
36
  from jaclang.runtimelib.archetype import (
37
- DataSpatialDestination,
38
- DataSpatialFunction,
39
- DataSpatialPath,
40
37
  GenericEdge as _GenericEdge,
38
+ ObjectSpatialDestination,
39
+ ObjectSpatialFunction,
40
+ ObjectSpatialPath,
41
41
  Root as _Root,
42
42
  )
43
43
  from jaclang.runtimelib.constructs import (
@@ -267,7 +267,7 @@ class JacNode:
267
267
 
268
268
  @staticmethod
269
269
  def get_edges(
270
- origin: list[NodeArchetype], destination: DataSpatialDestination
270
+ origin: list[NodeArchetype], destination: ObjectSpatialDestination
271
271
  ) -> list[EdgeArchetype]:
272
272
  """Get edges connected to this node."""
273
273
  edges: OrderedDict[EdgeAnchor, EdgeArchetype] = OrderedDict()
@@ -300,7 +300,7 @@ class JacNode:
300
300
  @staticmethod
301
301
  def get_edges_with_node(
302
302
  origin: list[NodeArchetype],
303
- destination: DataSpatialDestination,
303
+ destination: ObjectSpatialDestination,
304
304
  from_visit: bool = False,
305
305
  ) -> list[EdgeArchetype | NodeArchetype]:
306
306
  """Get edges connected to this node and the node."""
@@ -337,7 +337,7 @@ class JacNode:
337
337
 
338
338
  @staticmethod
339
339
  def edges_to_nodes(
340
- origin: list[NodeArchetype], destination: DataSpatialDestination
340
+ origin: list[NodeArchetype], destination: ObjectSpatialDestination
341
341
  ) -> list[NodeArchetype]:
342
342
  """Get set of nodes connected to this node."""
343
343
  nodes: OrderedDict[NodeAnchor, NodeArchetype] = OrderedDict()
@@ -424,36 +424,6 @@ class JacWalker:
424
424
  else:
425
425
  raise TypeError("Invalid walker object")
426
426
 
427
- @staticmethod
428
- def ignore(
429
- walker: WalkerArchetype,
430
- expr: (
431
- list[NodeArchetype | EdgeArchetype]
432
- | list[NodeArchetype]
433
- | list[EdgeArchetype]
434
- | NodeArchetype
435
- | EdgeArchetype
436
- ),
437
- ) -> bool: # noqa: ANN401
438
- """Jac's ignore stmt feature."""
439
- if isinstance(walker, WalkerArchetype):
440
- wanch = walker.__jac__
441
- before_len = len(wanch.ignores)
442
- for anchor in (
443
- (i.__jac__ for i in expr) if isinstance(expr, list) else [expr.__jac__]
444
- ):
445
- if anchor not in wanch.ignores:
446
- if isinstance(anchor, NodeAnchor):
447
- wanch.ignores.append(anchor)
448
- elif isinstance(anchor, EdgeAnchor):
449
- if target := anchor.target:
450
- wanch.ignores.append(target)
451
- else:
452
- raise ValueError("Edge has no target.")
453
- return len(wanch.ignores) > before_len
454
- else:
455
- raise TypeError("Invalid walker object")
456
-
457
427
  @staticmethod
458
428
  def spawn_call(
459
429
  walker: WalkerAnchor,
@@ -718,7 +688,7 @@ class JacClassReferences:
718
688
 
719
689
  TYPE_CHECKING: bool = TYPE_CHECKING
720
690
  EdgeDir: TypeAlias = EdgeDir
721
- DSFunc: TypeAlias = DataSpatialFunction
691
+ DSFunc: TypeAlias = ObjectSpatialFunction
722
692
 
723
693
  Obj: TypeAlias = Archetype
724
694
  Node: TypeAlias = NodeArchetype
@@ -728,7 +698,7 @@ class JacClassReferences:
728
698
  Root: TypeAlias = _Root
729
699
  GenericEdge: TypeAlias = _GenericEdge
730
700
 
731
- Path: TypeAlias = DataSpatialPath
701
+ Path: TypeAlias = ObjectSpatialPath
732
702
 
733
703
 
734
704
  class JacBuiltin:
@@ -1102,17 +1072,18 @@ class JacBasics:
1102
1072
  if custom:
1103
1073
  ctx.custom = expr
1104
1074
  else:
1075
+ print(expr)
1105
1076
  ctx.reports.append(expr)
1106
1077
 
1107
1078
  @staticmethod
1108
1079
  def refs(
1109
- path: DataSpatialPath | NodeArchetype | list[NodeArchetype],
1080
+ path: ObjectSpatialPath | NodeArchetype | list[NodeArchetype],
1110
1081
  ) -> (
1111
1082
  list[NodeArchetype] | list[EdgeArchetype] | list[NodeArchetype | EdgeArchetype]
1112
1083
  ):
1113
1084
  """Jac's apply_dir stmt feature."""
1114
- if not isinstance(path, DataSpatialPath):
1115
- path = DataSpatialPath(path, [DataSpatialDestination(EdgeDir.OUT)])
1085
+ if not isinstance(path, ObjectSpatialPath):
1086
+ path = ObjectSpatialPath(path, [ObjectSpatialDestination(EdgeDir.OUT)])
1116
1087
 
1117
1088
  origin = path.origin
1118
1089
 
@@ -1134,13 +1105,13 @@ class JacBasics:
1134
1105
 
1135
1106
  @staticmethod
1136
1107
  async def arefs(
1137
- path: DataSpatialPath | NodeArchetype | list[NodeArchetype],
1108
+ path: ObjectSpatialPath | NodeArchetype | list[NodeArchetype],
1138
1109
  ) -> None:
1139
1110
  """Jac's apply_dir stmt feature."""
1140
1111
  pass
1141
1112
 
1142
1113
  @staticmethod
1143
- def filter(
1114
+ def filter_on(
1144
1115
  items: list[Archetype],
1145
1116
  func: Callable[[Archetype], bool],
1146
1117
  ) -> list[Archetype]:
@@ -1226,7 +1197,7 @@ class JacBasics:
1226
1197
  return disconnect_occurred
1227
1198
 
1228
1199
  @staticmethod
1229
- def assign(target: list[T], attr_val: tuple[tuple[str], tuple[Any]]) -> list[T]:
1200
+ def assign_all(target: list[T], attr_val: tuple[tuple[str], tuple[Any]]) -> list[T]:
1230
1201
  """Jac's assign comprehension feature."""
1231
1202
  for obj in target:
1232
1203
  attrs, values = attr_val
@@ -1328,17 +1299,26 @@ class JacBasics:
1328
1299
  JacMachineInterface.get_context().mem.remove(anchor.id)
1329
1300
 
1330
1301
  @staticmethod
1331
- def entry(func: Callable) -> Callable:
1302
+ def on_entry(func: Callable) -> Callable:
1332
1303
  """Mark a method as jac entry with this decorator."""
1333
1304
  setattr(func, "__jac_entry", None) # noqa:B010
1334
1305
  return func
1335
1306
 
1336
1307
  @staticmethod
1337
- def exit(func: Callable) -> Callable:
1308
+ def on_exit(func: Callable) -> Callable:
1338
1309
  """Mark a method as jac exit with this decorator."""
1339
1310
  setattr(func, "__jac_exit", None) # noqa:B010
1340
1311
  return func
1341
1312
 
1313
+
1314
+ class JacByLLM:
1315
+ """Jac byLLM integration."""
1316
+
1317
+ @staticmethod
1318
+ def get_mtir(caller: Callable, args: dict, call_params: dict) -> object:
1319
+ """Get byLLM library."""
1320
+ return None
1321
+
1342
1322
  @staticmethod
1343
1323
  def sem(semstr: str, inner_semstr: dict[str, str]) -> Callable:
1344
1324
  """Attach the semstring to the given object."""
@@ -1352,11 +1332,39 @@ class JacBasics:
1352
1332
 
1353
1333
  @staticmethod
1354
1334
  def call_llm(model: object, mtir: object) -> Any: # noqa: ANN401
1355
- """Call the LLM model."""
1335
+ """Call the LLM model.
1336
+
1337
+ Note: This is for future uses of the feature in contexts that cannot be decorated.
1338
+ For most use cases, use the `by` decorator instead.
1339
+ """
1356
1340
  raise ImportError(
1357
1341
  "byLLM is not installed. Please install it with `pip install byllm` and run `jac clean`."
1358
1342
  )
1359
1343
 
1344
+ @staticmethod
1345
+ def by(model: object) -> Callable:
1346
+ """Python library mode decorator for Jac's by llm() syntax."""
1347
+
1348
+ def _decorator(caller: Callable) -> Callable:
1349
+ def _wrapped_caller(*args: object, **kwargs: object) -> object:
1350
+ invoke_args: dict[int | str, object] = {}
1351
+ for i, arg in enumerate(args):
1352
+ invoke_args[i] = arg
1353
+ for key, value in kwargs.items():
1354
+ invoke_args[key] = value
1355
+ mtir = JacMachine.get_mtir(
1356
+ caller=caller,
1357
+ args=invoke_args,
1358
+ call_params=(
1359
+ model.call_params if hasattr(model, "call_params") else {}
1360
+ ),
1361
+ )
1362
+ return JacMachine.call_llm(model, mtir)
1363
+
1364
+ return _wrapped_caller
1365
+
1366
+ return _decorator
1367
+
1360
1368
 
1361
1369
  class JacUtils:
1362
1370
  """Jac Machine Utilities."""
@@ -1573,6 +1581,7 @@ class JacMachineInterface(
1573
1581
  JacBuiltin,
1574
1582
  JacCmd,
1575
1583
  JacBasics,
1584
+ JacByLLM,
1576
1585
  JacUtils,
1577
1586
  ):
1578
1587
  """Jac Feature."""
@@ -1716,4 +1725,5 @@ class JacMachine(JacMachineInterface):
1716
1725
  JacMachine.base_path_dir = os.getcwd()
1717
1726
  JacMachine.program = JacProgram()
1718
1727
  JacMachine.pool = ThreadPoolExecutor()
1728
+ JacMachine.exec_ctx.mem.close()
1719
1729
  JacMachine.exec_ctx = ExecutionContext()
jaclang/settings.py CHANGED
@@ -14,13 +14,12 @@ class Settings:
14
14
  filter_sym_builtins: bool = True
15
15
  ast_symbol_info_detailed: bool = False
16
16
  pass_timer: bool = False
17
- collect_py_dep_debug: bool = False
18
17
  print_py_raised_ast: bool = False
19
18
 
20
19
  # Compiler configuration
21
- disable_mtllm: bool = False
22
20
  ignore_test_annex: bool = False
23
21
  pyout_jaclib_alias: str = "_jl"
22
+ library_mode: bool = False
24
23
  pyfile_raise: bool = False
25
24
  pyfile_raise_full: bool = False
26
25
 
@@ -0,0 +1,18 @@
1
+ obj A {
2
+ has b: B;
3
+ }
4
+ obj B {
5
+ has c: str;
6
+ }
7
+
8
+
9
+ with entry {
10
+ expr = "Hello Jaseci!";
11
+ a = A(B(expr));
12
+ match expr {
13
+ case a.b.c:
14
+ print("Matched a.b.c", a.b.c);
15
+ case _:
16
+ print("No match");
17
+ }
18
+ }
@@ -0,0 +1,7 @@
1
+ def total(values: Any) {
2
+ return sum(values);
3
+ }
4
+ with entry {
5
+ result = total((x * x) for x in range(5));
6
+ print(f"Result: {result}");
7
+ }
@@ -0,0 +1,5 @@
1
+ def total(values):
2
+ return sum(values)
3
+
4
+ result = total((x * x) for x in range(5))
5
+ print(result)
File without changes