Commit Graph

39 Commits

Author SHA1 Message Date
8541b3bc5b lang: codegen: msg generator can now accept recipient as a param rather than parsing it from the ast 2025-09-12 10:00:06 +01:00
bd0e60e209 lang: codegen: add generator for global variable declarations 2025-09-08 16:26:55 +01:00
c442e53ffe lang: codegen: implement while-loop code generation 2025-09-08 16:26:12 +01:00
8425e2db4b lang: codegen: implement for-loop code generation 2025-09-08 16:25:54 +01:00
68ca789e43 lang: codegen: cond: implement implicitly returning values from an if-else expression 2025-09-08 16:24:29 +01:00
42dd3ffffc lang: codegen: cond: fix gen_block not repeating the block node 2025-09-08 16:24:03 +01:00
84e6d4f2ed lang: codegen: expr: implement assignment and arithmetic-and-assign operator support 2025-09-08 16:22:37 +01:00
97f7782968 lang: codegen: expr: implement generating true/false/null constants 2025-09-08 16:22:06 +01:00
312e737f9f lang: codegen: implement returning the last value evaluated in a block 2025-09-08 16:21:05 +01:00
168310033d lang: codegen: implement variable declaration/resolution support in block generator 2025-09-08 16:20:41 +01:00
6844f498c5 lang: codegen: replace codegen_value with a new system for passing different types of values between code generators 2025-09-08 16:17:29 +01:00
7ee2e9dd81 lang: codegen: fix block code generator using unit_codegen_state 2025-09-08 16:10:47 +01:00
e5ea7b1134 lang: codegen: remove old var declaration generator 2025-09-08 16:10:11 +01:00
d532d9cff3 lang: codegen: fix free of mie_ctx that isn't allocated by ivy_codegen 2025-08-16 21:11:46 +01:00
adb326c795 lang: codegen: fix instr gen duplicating left operand 2025-08-16 21:00:50 +01:00
bda10b1166 lang: codegen: update mie_ctx include path 2025-08-16 21:00:22 +01:00
9f83929600 lang: update mie ir api usage 2025-06-02 11:31:35 +01:00
475575f76f lang: codegen: add for-loop generator 2025-05-08 10:53:00 +01:00
64d1015a3c lang: codegen: implement cond-group code generation 2025-04-28 15:44:44 +01:00
d37c07e5e4 lang: codegen: implement return generation 2025-04-24 09:25:36 +01:00
da4aa7df78 lang: codegen: function load now uses func type instead of id 2025-04-24 09:25:21 +01:00
614329091c lang: codegen: implement unit-package and unit-import generation 2025-04-23 15:44:01 +01:00
4ea9683880 lang: codegen: lambda s_outer_block is now only initialised once 2025-04-23 11:02:47 +01:00
2062ee631c lang: codegen: fix pop_generator_recurse only popping generators with a value_received callback defined 2025-04-23 11:01:12 +01:00
2eb358457c lang: codegen: fix serialisation of selectors with unnamed args 2025-04-23 11:00:57 +01:00
857d99ea34 lang: codegen: codegen_load_variable now supports loading non-ptr variables 2025-04-23 11:00:16 +01:00
07d16e7454 lang: codegen: fix segfault when serialising selector with unnamed args 2025-04-22 21:31:44 +01:00
b8459f9390 lang: codegen: implement lambda variable capture 2025-04-22 15:31:23 +01:00
7483b32c25 lang: codegen: redesign variable definition/resolution system to support capturing
the codegen scope system has been removed. instead, each generator state in the stack,
from the current state backwards, is informed when a variable is defined, resolved, or
captured.

when a variable is defined, the state stack is traversed back-to-front (current generator
first). each state has a chance to record the variable definition. once one state has
signalled that it has recorded the variable definition, the traversal ends.

when a variable is resolved, the state stack is traversed back-to-front (current generator
first). each state is asked whether or not it recognises the variable identifier being resolved.
if a state has the variable in question defined, it returns information about the variable
definition, and the traversal stops.

once a variable has been resolved, the state stack is traversed front-to-back (current generator
last), starting from the generator /after/ the one that provided the variable definition. each
generator in the iteration is given the chance to adjust the variable information, or generate
IR in response to the variable being accessed. this is used to implement variable capture,
where the state of a variable in the enclosing context is captured for later use.
2025-04-22 15:23:42 +01:00
f0869b5ba0 lang: codegen: start implementing lambda generation 2025-04-21 21:11:45 +01:00
4a258e2580 lang: codegen: implement fstring generation 2025-04-18 23:17:39 +01:00
2ddb065243 lang: codegen: disable CODEGEN_F_IGNORE_RESULT in expression generation
this flag caused some issues where the result of a message would
be ignored if it was the first operand in a larger expression.
2025-04-18 23:15:28 +01:00
11449b9919 lang: codegen: add support for non-fstrings to expr generator 2025-04-17 22:55:40 +01:00
abb7cfaf0e mie: move mie_ctx to a separate header 2025-04-17 22:25:36 +01:00
7b8d77a264 lang: codegen: implement message-send code generation and global var references 2025-04-17 21:44:38 +01:00
f0e6237473 lang: codegen: redesign again to use purely pre-order ast traversal 2025-04-16 21:58:52 +01:00
e430b7b2f1 lang: add var keyword for variable declarations
the var keyword allows greater control over what scope a
particular variable exists in. it clarifies whether a new
variable is being defined or an existing variable is being
assigned to. it will also facilitate the implementation of
global variables.
2025-04-15 11:02:47 +01:00
670b7c5a33 lang: codegen: redesign codegen to use a stack-based state machine 2025-04-14 20:15:05 +01:00
2cd78a64b0 lang: start implementing code generation (ast to ir) facility 2025-04-14 09:48:16 +01:00