jaclang 0.7.2__py3-none-any.whl → 0.7.5__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/cli/cli.py +2 -2
- jaclang/compiler/absyntree.py +337 -273
- jaclang/compiler/codeloc.py +2 -2
- jaclang/compiler/constant.py +2 -0
- jaclang/compiler/jac.lark +25 -19
- jaclang/compiler/parser.py +115 -92
- jaclang/compiler/passes/main/access_modifier_pass.py +15 -9
- jaclang/compiler/passes/main/def_impl_match_pass.py +25 -13
- jaclang/compiler/passes/main/def_use_pass.py +48 -17
- jaclang/compiler/passes/main/fuse_typeinfo_pass.py +34 -34
- jaclang/compiler/passes/main/import_pass.py +8 -6
- jaclang/compiler/passes/main/pyast_gen_pass.py +97 -42
- jaclang/compiler/passes/main/pyast_load_pass.py +47 -12
- jaclang/compiler/passes/main/pyjac_ast_link_pass.py +19 -10
- jaclang/compiler/passes/main/registry_pass.py +6 -6
- jaclang/compiler/passes/main/sym_tab_build_pass.py +30 -72
- jaclang/compiler/passes/main/tests/test_decl_def_match_pass.py +21 -4
- jaclang/compiler/passes/main/tests/test_def_use_pass.py +5 -10
- jaclang/compiler/passes/main/type_check_pass.py +2 -1
- jaclang/compiler/passes/tool/jac_formatter_pass.py +30 -9
- jaclang/compiler/passes/tool/tests/fixtures/corelib.jac +16 -0
- jaclang/compiler/passes/tool/tests/fixtures/corelib_fmt.jac +16 -0
- jaclang/compiler/passes/transform.py +2 -4
- jaclang/{core/registry.py → compiler/semtable.py} +1 -3
- jaclang/compiler/symtable.py +25 -37
- jaclang/compiler/tests/test_parser.py +2 -2
- jaclang/core/aott.py +8 -8
- jaclang/core/{construct.py → architype.py} +25 -240
- jaclang/core/constructs.py +44 -0
- jaclang/core/context.py +157 -0
- jaclang/core/importer.py +18 -9
- jaclang/core/memory.py +99 -0
- jaclang/core/test.py +90 -0
- jaclang/core/utils.py +2 -2
- jaclang/langserve/engine.py +32 -19
- jaclang/langserve/tests/fixtures/circle.jac +16 -12
- jaclang/langserve/tests/fixtures/circle_err.jac +3 -3
- jaclang/langserve/tests/test_server.py +3 -12
- jaclang/langserve/utils.py +10 -6
- jaclang/plugin/builtin.py +1 -1
- jaclang/plugin/default.py +21 -7
- jaclang/plugin/feature.py +24 -6
- jaclang/plugin/spec.py +17 -19
- jaclang/settings.py +3 -0
- jaclang/tests/fixtures/abc.jac +16 -12
- jaclang/tests/fixtures/byllmissue.jac +9 -0
- jaclang/tests/fixtures/edgetypetest.jac +16 -0
- jaclang/tests/fixtures/impl_match_confused.impl.jac +1 -0
- jaclang/tests/fixtures/impl_match_confused.jac +5 -0
- jaclang/tests/fixtures/maxfail_run_test.jac +17 -5
- jaclang/tests/fixtures/run_test.jac +17 -5
- jaclang/tests/test_bugs.py +19 -0
- jaclang/tests/test_cli.py +1 -1
- jaclang/tests/test_language.py +56 -1
- jaclang/tests/test_reference.py +1 -1
- jaclang/utils/lang_tools.py +5 -4
- jaclang/utils/test.py +2 -1
- jaclang/utils/treeprinter.py +22 -8
- {jaclang-0.7.2.dist-info → jaclang-0.7.5.dist-info}/METADATA +1 -1
- {jaclang-0.7.2.dist-info → jaclang-0.7.5.dist-info}/RECORD +62 -54
- {jaclang-0.7.2.dist-info → jaclang-0.7.5.dist-info}/WHEEL +0 -0
- {jaclang-0.7.2.dist-info → jaclang-0.7.5.dist-info}/entry_points.txt +0 -0
jaclang/compiler/codeloc.py
CHANGED
|
@@ -55,7 +55,7 @@ class CodeLocInfo:
|
|
|
55
55
|
@property
|
|
56
56
|
def last_line(self) -> int:
|
|
57
57
|
"""Get line number."""
|
|
58
|
-
return self.last_tok.
|
|
58
|
+
return self.last_tok.end_line
|
|
59
59
|
|
|
60
60
|
@property
|
|
61
61
|
def col_start(self) -> int:
|
|
@@ -107,4 +107,4 @@ class CodeLocInfo:
|
|
|
107
107
|
|
|
108
108
|
def __str__(self) -> str:
|
|
109
109
|
"""Stringify."""
|
|
110
|
-
return f"{self.
|
|
110
|
+
return f"{self.first_line}:{self.col_start} - {self.last_line}:{self.col_end}"
|
jaclang/compiler/constant.py
CHANGED
|
@@ -28,6 +28,7 @@ class Constants(str, Enum):
|
|
|
28
28
|
|
|
29
29
|
PYNLINE = "::py::"
|
|
30
30
|
JAC_GEN_DIR = "__jac_gen__"
|
|
31
|
+
JAC_MYPY_CACHE = ".jac_mypy_cache"
|
|
31
32
|
|
|
32
33
|
def __str__(self) -> str:
|
|
33
34
|
"""Return the string representation of the token."""
|
|
@@ -99,6 +100,7 @@ class Tokens(str, Enum):
|
|
|
99
100
|
KW_AWAIT = "KW_AWAIT"
|
|
100
101
|
KW_TEST = "KW_TEST"
|
|
101
102
|
KW_ASSERT = "KW_ASSERT"
|
|
103
|
+
KW_CHECK = "KW_CHECK"
|
|
102
104
|
COLON = "COLON"
|
|
103
105
|
PIPE_FWD = "PIPE_FWD"
|
|
104
106
|
PIPE_BKWD = "PIPE_BKWD"
|
jaclang/compiler/jac.lark
CHANGED
|
@@ -30,7 +30,10 @@ sub_name: COLON NAME
|
|
|
30
30
|
include_stmt: KW_INCLUDE sub_name import_path SEMI
|
|
31
31
|
|
|
32
32
|
// Architypes
|
|
33
|
-
architype: decorators?
|
|
33
|
+
architype: decorators? architype_decl
|
|
34
|
+
| architype_def
|
|
35
|
+
| enum
|
|
36
|
+
|
|
34
37
|
architype_decl: arch_type access_tag? STRING? NAME inherited_archs? (member_block | SEMI)
|
|
35
38
|
architype_def: abil_to_arch_chain member_block
|
|
36
39
|
decorators: (DECOR_OP atomic_chain)+
|
|
@@ -54,8 +57,8 @@ typed_has_clause: named_ref (COLON STRING)? type_tag (EQ expression | KW_BY KW_P
|
|
|
54
57
|
type_tag: COLON expression
|
|
55
58
|
|
|
56
59
|
// Enumerations
|
|
57
|
-
enum:
|
|
58
|
-
|
|
|
60
|
+
enum: decorators? enum_decl
|
|
61
|
+
| enum_def
|
|
59
62
|
|
|
60
63
|
enum_decl: KW_ENUM access_tag? STRING? NAME inherited_archs? (enum_block | SEMI)
|
|
61
64
|
enum_def: arch_to_enum_chain enum_block
|
|
@@ -64,16 +67,17 @@ enum_block: LBRACE ((enum_stmt COMMA)* enum_stmt)? RBRACE
|
|
|
64
67
|
enum_stmt: NAME (COLON STRING)? EQ expression
|
|
65
68
|
| NAME (COLON STRING)?
|
|
66
69
|
| py_code_block
|
|
70
|
+
| free_code
|
|
67
71
|
|
|
68
72
|
// Abilities
|
|
69
|
-
ability: decorators?
|
|
70
|
-
| decorators? KW_ASYNC? ability_decl
|
|
73
|
+
ability: decorators? KW_ASYNC? ability_decl
|
|
71
74
|
| decorators? genai_ability
|
|
75
|
+
| ability_def
|
|
72
76
|
|
|
73
|
-
ability_decl: KW_OVERRIDE? KW_STATIC? KW_CAN access_tag? STRING?
|
|
77
|
+
ability_decl: KW_OVERRIDE? KW_STATIC? KW_CAN access_tag? STRING? named_ref (func_decl | event_clause) (code_block | SEMI)
|
|
74
78
|
ability_def: arch_to_abil_chain (func_decl | event_clause) code_block
|
|
75
|
-
abstract_ability: KW_OVERRIDE? KW_STATIC? KW_CAN access_tag? STRING?
|
|
76
|
-
genai_ability: KW_OVERRIDE? KW_STATIC? KW_CAN access_tag? STRING?
|
|
79
|
+
abstract_ability: KW_OVERRIDE? KW_STATIC? KW_CAN access_tag? STRING? named_ref (func_decl | event_clause) KW_ABSTRACT SEMI
|
|
80
|
+
genai_ability: KW_OVERRIDE? KW_STATIC? KW_CAN access_tag? STRING? named_ref (func_decl) KW_BY atomic_call SEMI
|
|
77
81
|
event_clause: KW_WITH expression? (KW_EXIT | KW_ENTRY) (STRING? RETURN_HINT expression)?
|
|
78
82
|
func_decl: (LPAREN func_decl_params? RPAREN)? (RETURN_HINT (STRING COLON)? expression)?
|
|
79
83
|
func_decl_params: (param_var COMMA)* param_var
|
|
@@ -128,9 +132,10 @@ statement: import_stmt
|
|
|
128
132
|
| nonlocal_ref SEMI
|
|
129
133
|
| typed_ctx_block
|
|
130
134
|
| return_stmt SEMI
|
|
131
|
-
| yield_expr SEMI
|
|
135
|
+
| (yield_expr | KW_YIELD) SEMI
|
|
132
136
|
| raise_stmt SEMI
|
|
133
137
|
| assert_stmt SEMI
|
|
138
|
+
| check_stmt SEMI
|
|
134
139
|
| assignment SEMI
|
|
135
140
|
| delete_stmt SEMI
|
|
136
141
|
| report_stmt SEMI
|
|
@@ -219,7 +224,6 @@ return_stmt: KW_RETURN expression?
|
|
|
219
224
|
|
|
220
225
|
// Yield statements
|
|
221
226
|
yield_expr: KW_YIELD KW_FROM? expression
|
|
222
|
-
| KW_YIELD
|
|
223
227
|
|
|
224
228
|
// Raise statements
|
|
225
229
|
raise_stmt: KW_RAISE (expression (KW_FROM expression)?)?
|
|
@@ -227,6 +231,9 @@ raise_stmt: KW_RAISE (expression (KW_FROM expression)?)?
|
|
|
227
231
|
// Assert statements
|
|
228
232
|
assert_stmt: KW_ASSERT expression (COMMA expression)?
|
|
229
233
|
|
|
234
|
+
// Check statements
|
|
235
|
+
check_stmt: KW_CHECK expression
|
|
236
|
+
|
|
230
237
|
// Delete statements
|
|
231
238
|
delete_stmt: KW_DELETE expression
|
|
232
239
|
|
|
@@ -279,7 +286,7 @@ expression: walrus_assign (KW_IF expression KW_ELSE expression)?
|
|
|
279
286
|
| lambda_expr
|
|
280
287
|
|
|
281
288
|
// Walrus assignments
|
|
282
|
-
walrus_assign: (
|
|
289
|
+
walrus_assign: (named_ref WALRUS_EQ)? pipe
|
|
283
290
|
|
|
284
291
|
// Lambda expressions
|
|
285
292
|
lambda_expr: KW_WITH func_decl_params? (RETURN_HINT expression)? KW_CAN expression
|
|
@@ -345,7 +352,7 @@ pipe_call: (PIPE_FWD | A_PIPE_FWD | KW_SPAWN | KW_AWAIT)? atomic_chain
|
|
|
345
352
|
|
|
346
353
|
// Subscripted and dotted expressions
|
|
347
354
|
atomic_chain: atomic_chain NULL_OK? (filter_compr | assign_compr | index_slice)
|
|
348
|
-
| atomic_chain NULL_OK? (DOT_BKWD | DOT_FWD | DOT)
|
|
355
|
+
| atomic_chain NULL_OK? (DOT_BKWD | DOT_FWD | DOT) named_ref
|
|
349
356
|
| (atomic_call | atom | edge_ref_chain)
|
|
350
357
|
|
|
351
358
|
index_slice: LSQUARE expression? COLON expression? (COLON expression?)? RSQUARE
|
|
@@ -359,10 +366,11 @@ param_list: expr_list COMMA kw_expr_list
|
|
|
359
366
|
| expr_list
|
|
360
367
|
|
|
361
368
|
// Atom
|
|
362
|
-
atom:
|
|
369
|
+
atom: named_ref
|
|
363
370
|
| LPAREN (expression | yield_expr) RPAREN
|
|
364
371
|
| atom_collection
|
|
365
372
|
| atom_literal
|
|
373
|
+
| type_ref
|
|
366
374
|
|
|
367
375
|
atom_literal: builtin_type
|
|
368
376
|
| NULL
|
|
@@ -375,6 +383,8 @@ atom_literal: builtin_type
|
|
|
375
383
|
| HEX
|
|
376
384
|
| INT
|
|
377
385
|
|
|
386
|
+
type_ref: TYPE_OP (named_ref | builtin_type)
|
|
387
|
+
|
|
378
388
|
multistring: (fstring | STRING | DOC_STRING)+
|
|
379
389
|
|
|
380
390
|
fstring: FSTR_START fstr_parts FSTR_END
|
|
@@ -415,7 +425,7 @@ tuple_list: expression COMMA expr_list COMMA kw_expr_list
|
|
|
415
425
|
| kw_expr_list
|
|
416
426
|
|
|
417
427
|
kw_expr_list: (kw_expr_list COMMA)? kw_expr
|
|
418
|
-
kw_expr:
|
|
428
|
+
kw_expr: named_ref EQ expression | STAR_POW expression
|
|
419
429
|
|
|
420
430
|
// Data Spatial References
|
|
421
431
|
edge_ref_chain: (EDGE_OP|NODE_OP)? LSQUARE expression? (edge_op_ref (filter_compr | expression)?)+ RSQUARE
|
|
@@ -438,15 +448,10 @@ typed_filter_compare_list: expression (COLON filter_compare_list)?
|
|
|
438
448
|
filter_compare_item: named_ref cmp_op expression
|
|
439
449
|
|
|
440
450
|
// Names and references
|
|
441
|
-
any_ref: named_ref
|
|
442
|
-
| type_ref
|
|
443
|
-
|
|
444
451
|
named_ref: special_ref
|
|
445
452
|
| KWESC_NAME
|
|
446
453
|
| NAME
|
|
447
454
|
|
|
448
|
-
type_ref: TYPE_OP (named_ref | builtin_type)
|
|
449
|
-
|
|
450
455
|
special_ref: KW_INIT
|
|
451
456
|
| KW_POST_INIT
|
|
452
457
|
| KW_ROOT
|
|
@@ -502,6 +507,7 @@ KW_ASYNC: "async"
|
|
|
502
507
|
KW_AWAIT: "await"
|
|
503
508
|
KW_TEST: "test"
|
|
504
509
|
KW_ASSERT: "assert"
|
|
510
|
+
KW_CHECK: "check"
|
|
505
511
|
KW_IF: "if"
|
|
506
512
|
KW_ELIF: "elif"
|
|
507
513
|
KW_ELSE: "else"
|