Basic type checker #6

Merged
HEL merged 74 commits from feat/basic-type-checker into main 2026-06-05 09:31:54 +00:00

74 Commits

Author SHA1 Message Date
19b9fdd623 Merge pull request 'Improve syntax and types' (#5) from feat/improve-syntax-and-types into feat/basic-type-checker
Reviewed-on: #5
2026-06-05 09:20:56 +00:00
ddcaebb51a fix: remove outdated syntax definition 2026-06-05 11:19:29 +02:00
f182312cd2 fix: update midas syntax definitions 2026-06-05 11:14:53 +02:00
73b21789d5 fix(tests): remove custom imports 2026-06-05 10:48:46 +02:00
5d7c724bc8 fix(cli): add types files argument 2026-06-05 10:44:20 +02:00
74b297c89c feat(checker): remove custom midas import
remove custom import statement (`midas.using`) in favor of passing type definition files as arguments to the checker
2026-06-05 10:43:52 +02:00
822a74acce refactor(checker): rename methods
improve a couple methods names, namely evaluate → type_of and evaluate_block → process_block
2026-06-03 13:03:41 +02:00
9a934fabfd tests: remove union type 2026-06-02 17:22:19 +02:00
828ec9a3fa fix!: remove union type 2026-06-02 17:19:17 +02:00
63a43d79dd chore: update examples 2026-06-02 13:07:53 +02:00
029caf4526 fix(tests): update tests with new syntax 2026-06-02 13:05:38 +02:00
1c5c418f1c fix(tests): serialize ternary expressions 2026-06-02 13:05:06 +02:00
a4139d4652 feat(checker): handle logical expressions 2026-06-02 13:03:07 +02:00
2fd2071d40 feat(parser): parse pass statement and None 2026-06-02 13:02:45 +02:00
97b1ee8ab8 feat(cli): add format command 2026-06-02 13:00:43 +02:00
dee479def5 fix(checker): wrap type definitions in AliasType 2026-06-02 13:00:03 +02:00
c8536e20d2 feat(tests): update Midas serializer 2026-06-02 12:38:58 +02:00
d70137775f feat(cli): update highlighter with new nodes 2026-06-02 12:29:39 +02:00
35ceda99aa chore: tidy 2026-06-02 11:45:49 +02:00
7f3d74ee49 feat(checker)!: resolve new types 2026-06-02 11:44:31 +02:00
b9f378de6f feat(parser)!: update Midas parser with new nodes 2026-06-02 11:42:35 +02:00
ccb17c7290 feat(parser)!: add new Midas AST nodes 2026-06-02 11:41:53 +02:00
505779310a feat: add new midas syntax example 2026-06-02 11:40:42 +02:00
bea3f399ad feat(checker): handle ternary expression 2026-06-01 15:02:12 +02:00
55060bfecd feat(parser): add ternary statement 2026-06-01 15:00:21 +02:00
dd126f2559 fix(cli): improve diagnostic message popup 2026-06-01 14:48:24 +02:00
4151f5373d fix(checker): early define fully-typed function
to handle simple recursion cases where the function has an explicit return type hint, the function must be defined before evaluating its body
2026-06-01 14:40:42 +02:00
bd31713ab4 tests(checker): add control flow test 2026-06-01 14:22:03 +02:00
f4dc57cb96 chore: add control flow example 2026-06-01 14:15:10 +02:00
261fd47494 feat(cli): update highlighter 2026-06-01 14:14:10 +02:00
1b66a8553d fix(checker): handle paths with no returns in functions 2026-06-01 14:13:48 +02:00
65164abadb feat(checker): type check if statements 2026-06-01 14:13:17 +02:00
9d45163d9c feat(checker): handle comparisons 2026-06-01 14:12:22 +02:00
ab0fa1de1a feat(parser): add if statement 2026-06-01 14:11:12 +02:00
5d4df7978b fix(cli): ignore repeated visit of types 2026-06-01 14:10:07 +02:00
86ad348b99 feat(cli): add option to highlight diagnostics 2026-06-01 11:57:57 +02:00
29f691e38a fix: update vscode syntax 2026-06-01 11:30:56 +02:00
f2c61d24e2 refactor(checker): move builtins definition to separate file 2026-06-01 00:55:54 +02:00
112ed0e816 feat(parser): desugar AugAssign statements 2026-05-31 18:54:55 +02:00
7eb1e13b70 fix(cli): add cast visitor method to highlighter 2026-05-31 18:45:25 +02:00
893e1ba190 feat(cli): dump environment after compile 2026-05-31 18:44:41 +02:00
1a1b0e8e15 docs(checker): add documentation to checker, resolvers, etc. 2026-05-31 18:42:53 +02:00
4ddde364ed doc(checker): add documentation to checker methods 2026-05-31 12:56:20 +02:00
4a3363a3d6 feat(checker): add cast expression 2026-05-29 22:04:03 +02:00
0a3216e07d feat(parser):add cast expression 2026-05-29 22:03:39 +02:00
c29c0ed3ec tests: add tests for type checker 2026-05-29 19:08:58 +02:00
fa7e56cb77 tests: add checker tester 2026-05-29 19:08:41 +02:00
13c19db818 fix(checker): stabilize call error message
display missing arguments in a stable format, similar to how native Python does
2026-05-29 19:08:13 +02:00
95b218fbed tests: add tests for python parser 2026-05-29 18:45:06 +02:00
c3722c7438 tests: add python parser tester 2026-05-29 18:44:53 +02:00
9dd547d6c1 fix(tests): handle new tests with no snapshot 2026-05-29 18:44:28 +02:00
e2d5943517 tests: move midas parser tests in subfolder 2026-05-29 18:39:25 +02:00
86e4763a12 refactor(tests): make cases dir configurable in subclass 2026-05-29 17:52:10 +02:00
89ec63cb05 refactor(tests): extract tester base class 2026-05-29 17:42:39 +02:00
e6375f1aa9 chore: tidy 2026-05-29 17:25:12 +02:00
d16e192a3a feat(checker): map and check function call arguments 2026-05-29 15:49:51 +02:00
3f61f84e5a feat(parser): parse function param defaults and sinks 2026-05-29 15:47:19 +02:00
fd5399f50a feat(checker): evaluate function definitions 2026-05-29 12:10:09 +02:00
8906ac3db8 feat(parser): add return statements 2026-05-29 11:25:11 +02:00
022aebf55b fix(parser): prevent duplicate properties in complex types 2026-05-29 10:41:54 +02:00
5dc6903425 fix(cli): enable midas ast dump 2026-05-29 10:41:31 +02:00
1b078b832c chore: add some operations in the example 2026-05-28 18:32:35 +02:00
7515716864 feat(checker): add diagnostics 2026-05-28 18:32:35 +02:00
218b0c5b78 fix(parser): add location in all AST nodes 2026-05-28 18:32:34 +02:00
928901ef9c fix(checker): get literal types from context 2026-05-28 18:16:35 +02:00
4b62c78874 feat(cli): integrate checker in compile command 2026-05-28 17:35:38 +02:00
f882eebaf5 feat(checker): add basic checker
still very basic but lays out the structure and help methods
2026-05-28 17:35:00 +02:00
a872938405 feat(checker): add midas context resolver
this is still very basic and only handle a few expressions
notably, it doesn't support generics, option types, conditions, predicates nor complex types
2026-05-28 17:33:16 +02:00
146be72fd7 chore: add simple operation and type examples 2026-05-28 17:31:12 +02:00
6de54e1da1 feat(checker): add python scope resolver
adapted from Pebble
2026-05-28 17:30:16 +02:00
c82b41a4df feat(checker): add environment manager
adapted from Pebble
2026-05-28 17:29:37 +02:00
8304760fe0 fix(parser): add function body and all_args property 2026-05-28 15:26:53 +02:00
6bf91db757 feat(checker): create basic type and operation structs 2026-05-28 15:25:48 +02:00
3f6b650a4b docs: create architecture diagram 2026-05-28 15:25:12 +02:00