Commit Graph

8 Commits

Author SHA1 Message Date
64d1015a3c lang: codegen: implement cond-group code generation 2025-04-28 15:44:44 +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
857d99ea34 lang: codegen: codegen_load_variable now supports loading non-ptr variables 2025-04-23 11:00:16 +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
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
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