diff options
| author | Kai Stevenson <kai@kaistevenson.com> | 2025-11-02 20:07:43 -0800 |
|---|---|---|
| committer | Kai Stevenson <kai@kaistevenson.com> | 2025-11-02 20:07:43 -0800 |
| commit | 4dc08222b1b9160a699a03fca7cc0e21cc4bdece (patch) | |
| tree | 8edb8f376df15d80a03e334a5bc66bc07ac05a4f /src/lang/core/common.ts | |
| parent | 5fdaa70d0af1356652de38f66fccef4bd3088a26 (diff) | |
cleanup
Diffstat (limited to 'src/lang/core/common.ts')
| -rw-r--r-- | src/lang/core/common.ts | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/lang/core/common.ts b/src/lang/core/common.ts index c1a1dc3..9e3840b 100644 --- a/src/lang/core/common.ts +++ b/src/lang/core/common.ts @@ -55,3 +55,18 @@ export type ParserCtx = { lastToken: Token | null; stack: readonly ASTNode[]; }; + +export type StackFrame< + Bindings extends Record<ASTNode["name"], any> = Record<ASTNode["name"], any>, + Parent extends StackFrame | null = any +> = { + bindings: Bindings; + parent: Parent; +}; + +export type EmptyStackFrame = StackFrame<{}, null>; + +export type WithPushedBindings< + OldFrame extends StackFrame, + Bindings extends StackFrame["bindings"] +> = StackFrame<Bindings, OldFrame>; |
