lambdas and application now in AST, types and interpreter

This commit is contained in:
Dustin Swan 2026-01-30 21:31:06 -07:00
parent d60e5aa29f
commit 920151f49c
No known key found for this signature in database
GPG key ID: 30D46587E2100467
4 changed files with 102 additions and 4 deletions

View file

@ -1,4 +1,4 @@
import type { Value } from './types';
import type { Value, Closure } from './types';
export type Literal = {
kind: 'literal'
@ -31,4 +31,16 @@ export type If = {
else: AST
}
export type AST = Literal | BinaryOp | Variable | Let | If
export type Lambda = {
kind: 'lambda'
params: string[]
body: AST
}
export type Apply = {
kind: 'apply'
func: AST
args: AST[]
}
export type AST = Literal | BinaryOp | Variable | Let | If | Lambda | Apply