Commit Graph

12 Commits

Author SHA1 Message Date
adb326c795 lang: codegen: fix instr gen duplicating left operand 2025-08-16 21:00:50 +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
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
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