Refactor lambda binding and parameter handling

Introduce `BoundKind::Parameter` to represent function parameters.
Modify `Binder` to correctly handle parameters within lambda
definitions, ensuring they are only defined within function scopes.
Update `LambdaCollector` to register the body of lambdas as templates
for global definitions.
Adjust `Dumper` to accurately represent lambda parameters.
Update `Specializer` and `TCO` to handle the new `BoundKind::Parameter`.
Refactor `Call` and `TailCall` to use a single `args` node, often a
tuple.
Adjust type signatures in RTL to use `StaticType::Tuple` for function
parameters.
This commit is contained in:
Michael Schimmel
2026-02-20 12:14:22 +01:00
parent 8d6d3be5c2
commit e2279f214b
17 changed files with 497 additions and 247 deletions
+4 -3
View File
@@ -58,6 +58,7 @@ pub enum UntypedKind {
Nop,
Constant(Value),
Identifier(Symbol),
Parameter(Symbol),
If {
cond: Box<Node<UntypedKind>>,
then_br: Box<Node<UntypedKind>>,
@@ -72,12 +73,12 @@ pub enum UntypedKind {
value: Box<Node<UntypedKind>>,
},
Lambda {
params: Vec<Symbol>,
params: Box<Node<UntypedKind>>,
body: Rc<Node<UntypedKind>>,
},
Call {
callee: Box<Node<UntypedKind>>,
args: Vec<Node<UntypedKind>>,
args: Box<Node<UntypedKind>>,
},
Block {
exprs: Vec<Node<UntypedKind>>,
@@ -91,7 +92,7 @@ pub enum UntypedKind {
/// A macro declaration that can be expanded at compile time.
MacroDecl {
name: Symbol,
params: Vec<Symbol>,
params: Box<Node<UntypedKind>>,
body: Box<Node<UntypedKind>>,
},
/// A template for AST nodes, allowing for substitutions. (Quasiquote)