Commit graph

86 commits

Author SHA1 Message Date
8b0ec8cbe2
errors: use termcolor for terminal output coloring + enable raising non-fatal errors 2024-01-06 00:17:47 +01:00
cd42fac98e
nodes: add missing reader tracking to function calls 2024-01-05 23:41:41 +01:00
714c9b490e
semantic: warn on variable shadowing 2024-01-05 23:40:58 +01:00
1bf549eda4
semantic: better handle builtins
Attach them to a pseudo-node "builtin" for the sake of better diagnostics and assignment tracking
2024-01-05 23:40:31 +01:00
dfa24f2d67
main+ir: do register allocation + show updated register names 2024-01-05 23:37:56 +01:00
3e59cc84a7
main: update IR locations + catch and print warnings 2024-01-05 23:34:42 +01:00
5ed4c55522
main: refactor IR printing 2024-01-05 23:31:47 +01:00
c29d4cd9ec
optimizations/register_allocation: init 2024-01-05 23:29:53 +01:00
393615b234
ir: IRAssignable add helper property to give a sorted list of all uses (read or write) of the value 2024-01-05 23:28:07 +01:00
4469a94096
ir: track value reads and writes in every IRAction manipulating data 2024-01-05 23:27:19 +01:00
6af9c367c6
ir: automatically add read-from/written-to values in IRAction if declared 2024-01-05 23:22:37 +01:00
39c12a360c
source: add IRLocation type specifically for generated IR 2024-01-05 23:17:31 +01:00
6bbe2b195e
ir: IRRegister: track registers (statefully) 2024-01-05 23:15:52 +01:00
fb62c3b34a
ir: IRAssignable: track writers 2024-01-05 23:14:55 +01:00
27ccb1a68a
ir: IRValue: track readers 2024-01-05 23:13:45 +01:00
18a813f4c7
utils: add equivalence 2024-01-05 23:12:22 +01:00
43b2dc9e93
source: Location: prepare for builtins 2024-01-05 23:11:32 +01:00
3fa039110b
errors: add warning implementation + fix a few issues 2024-01-05 23:03:32 +01:00
29d6d1a8de
meta: add GPLv3 license 2023-05-24 00:58:50 +02:00
6ccf556150
logger: fix missing whitespace 2023-05-24 00:49:05 +02:00
9463af0014
parser: move parenthesized expression handling to a dedicated function 2023-05-24 00:48:43 +02:00
275728a635
parser: update factor unexpected token error message 2023-05-24 00:46:04 +02:00
92a6686097
main: comment unused variables in mock 2023-05-24 00:45:09 +02:00
ab7ee592c3
main+lexer: add support for single-line comments 2023-05-24 00:44:46 +02:00
3f84890b52
nodes: allow adding pseudo nodes to Expression 2023-05-24 00:44:16 +02:00
1fa3317d93
main: do context semantic checking 2023-05-24 00:25:16 +02:00
f060608e73
semantic: add semantic checks for variables
Check read before first assignment
Check unused variables
2023-05-24 00:24:44 +02:00
bcca6d4a6e
source: make SourceLocation comparable 2023-05-24 00:22:50 +02:00
8c26293416
semantic+nodes: record variable definitions 2023-05-24 00:22:22 +02:00
88526aa5e6
semantic+nodes: record variable reads 2023-05-24 00:19:07 +02:00
f08d697699
nodes: assignments are not pure if the value is not None 2023-05-24 00:13:56 +02:00
067dc7f982
lexer: identifier are bounded by word boundaries 2023-05-24 00:13:10 +02:00
1e9843ec0e
errors: show location before the message 2023-05-24 00:12:36 +02:00
717bd60e86
main: add function call to mock 2023-05-23 23:26:05 +02:00
ec1001bfd3
parser: parse function calls 2023-05-23 23:24:36 +02:00
a092c11216
nodes: add Call node 2023-05-23 23:23:20 +02:00
39a5f084ba
ir: add IRCall 2023-05-23 23:16:23 +02:00
5b42c05eab
semantic: add Function semantic type, which is a special case of Type
Also define display in builtin context
2023-05-23 23:14:16 +02:00
5252f772ed
semantic: display Types in context pretty-printing 2023-05-23 23:12:28 +02:00
20731d969e
nodes: fix some issues in Blocks (regarding purity consideration for IR)
No longer special case the last node in a Block.
Call super() semantic analysis for variables.
This may prevent some future issues.
2023-05-23 23:11:05 +02:00
6b3c0e8fe3
nodes: add PseudoNodes to statements, for better display and diagnostics 2023-05-23 23:07:50 +02:00
066470b120
nodes: introduce the concept of purity
IR of pure statements is not generated in Block node
2023-05-23 01:07:03 +02:00
49bb3f6aaa
semantic: separate assignments from definitions
Variables are no longer implicitly defined
2023-05-23 00:57:31 +02:00
c2faff23e1
parser: parse definitions
let var: type
let var: type = value
2023-05-23 00:55:36 +02:00
28ad2e2184
nodes: prepare Definition node 2023-05-23 00:54:38 +02:00
81316ead45
lexer: add keywords ("let") and their special handling 2023-05-23 00:50:40 +02:00
109a8aad13
utils: init with implies implementation 2023-05-23 00:50:11 +02:00
45ce13ae99
semantic+main: add the BuiltinContext and use it as semantic root 2023-05-23 00:48:52 +02:00
159ee81375
semantic: refactor types and variable handling 2023-05-23 00:47:09 +02:00
98f0465238
semantic: add the concept of Types 2023-05-23 00:45:02 +02:00