glisp / types
types
Classes
AccessAST
Defined in: types.ts:237
Accessor sugar: target.key. Has the same evaluation semantics as Call(target, [Lit(key)]), but kept as a distinct kind for unparse.
Extends
Constructors
Constructor
new AccessAST(
target,key):AccessAST
Defined in: types.ts:239
Parameters
| Parameter | Type |
|---|---|
target | AST |
key | string | number |
Returns
Overrides
Properties
| Property | Modifier | Type | Description | Overrides | Inherited from |
|---|---|---|---|---|---|
key | readonly | string | number | - | - | - |
kind | readonly | "access" | - | ASTNode.kind | - |
source? | public | SourceRange | Original source range. Mutable on construction (the parser stamps it after building the node). Builder-produced nodes leave it undefined and print() falls through to structural rendering. | - | ASTNode.source |
target | readonly | AST | - | - | - |
trivia? | readonly | Trivia | - | - | ASTNode.trivia |
Methods
meta()
meta(
content):MetaAST
Defined in: types.ts:78
Attach metadata to this node. Returns a new MetaAST wrapping the current expression with a record of the given fields. Plain JS values in the content map are auto-lifted to LitAST.
Parameters
| Parameter | Type |
|---|---|
content | MetaContent |
Returns
Inherited from
print()
print():
string
Defined in: types.ts:92
Render this AST back to Glisp source. If a source range is stamped, returns the original text verbatim — preserving comments and the exact whitespace layout. Otherwise delegates to printStructural, which each subclass overrides for builder-style emission.
Returns
string
Inherited from
printStructural()
printStructural():
string
Defined in: types.ts:246
Builder-style rendering. Used when no source range is attached.
Returns
string
Overrides
abstract ASTNode
Defined in: types.ts:62
Base class for all AST nodes. Subclasses set kind as a literal type so the class hierarchy doubles as a discriminated union when narrowing.
Extended by
LitASTHostASTSymASTCallASTAccessASTVecASTRecordASTLetASTFnASTPathASTQuoteASTUnquoteASTSpreadASTSpliceASTMetaAST
Constructors
Constructor
new ASTNode():
ASTNode
Returns
Properties
| Property | Modifier | Type | Description |
|---|---|---|---|
kind | abstract | string | - |
source? | public | SourceRange | Original source range. Mutable on construction (the parser stamps it after building the node). Builder-produced nodes leave it undefined and print() falls through to structural rendering. |
trivia? | readonly | Trivia | - |
Methods
meta()
meta(
content):MetaAST
Defined in: types.ts:78
Attach metadata to this node. Returns a new MetaAST wrapping the current expression with a record of the given fields. Plain JS values in the content map are auto-lifted to LitAST.
Parameters
| Parameter | Type |
|---|---|
content | MetaContent |
Returns
print()
print():
string
Defined in: types.ts:92
Render this AST back to Glisp source. If a source range is stamped, returns the original text verbatim — preserving comments and the exact whitespace layout. Otherwise delegates to printStructural, which each subclass overrides for builder-style emission.
Returns
string
printStructural()
abstractprintStructural():string
Defined in: types.ts:100
Builder-style rendering. Used when no source range is attached.
Returns
string
CallAST
Defined in: types.ts:211
Application AST. args is positional; kwargs are keyword arguments (any positional parameter may be passed by name — see syntax.md).
Spread arguments at the call site are represented as SpreadAST inside args (e.g. (f a ...xs b) becomes args = [a, spread(xs), b]).
Extends
Constructors
Constructor
new CallAST(
head,args,kwargs?):CallAST
Defined in: types.ts:213
Parameters
| Parameter | Type |
|---|---|
head | AST |
args | readonly AST[] |
kwargs? | ReadonlyMap<string, AST> |
Returns
Overrides
Properties
| Property | Modifier | Type | Description | Overrides | Inherited from |
|---|---|---|---|---|---|
args | readonly | readonly AST[] | - | - | - |
head | readonly | AST | - | - | - |
kind | readonly | "call" | - | ASTNode.kind | - |
kwargs? | readonly | ReadonlyMap<string, AST> | - | - | - |
source? | public | SourceRange | Original source range. Mutable on construction (the parser stamps it after building the node). Builder-produced nodes leave it undefined and print() falls through to structural rendering. | - | ASTNode.source |
trivia? | readonly | Trivia | - | - | ASTNode.trivia |
Methods
meta()
meta(
content):MetaAST
Defined in: types.ts:78
Attach metadata to this node. Returns a new MetaAST wrapping the current expression with a record of the given fields. Plain JS values in the content map are auto-lifted to LitAST.
Parameters
| Parameter | Type |
|---|---|
content | MetaContent |
Returns
Inherited from
print()
print():
string
Defined in: types.ts:92
Render this AST back to Glisp source. If a source range is stamped, returns the original text verbatim — preserving comments and the exact whitespace layout. Otherwise delegates to printStructural, which each subclass overrides for builder-style emission.
Returns
string
Inherited from
printStructural()
printStructural():
string
Defined in: types.ts:221
Builder-style rendering. Used when no source range is attached.
Returns
string
Overrides
FnAST
Defined in: types.ts:376
Function literal. With body: null it expresses a pure function-type (no implementation), used in type positions.
Chain methods .withGenerics(...) and .withBody(expr) produce a new FnAST; the original is unchanged. The method names use with* to avoid clashing with the same-name fields.
Extends
Constructors
Constructor
new FnAST(
generics,params,returnType,body):FnAST
Defined in: types.ts:378
Parameters
| Parameter | Type |
|---|---|
generics | readonly string[] |
params | readonly FnParam[] |
returnType | AST |
body | AST | null |
Returns
Overrides
Properties
| Property | Modifier | Type | Description | Overrides | Inherited from |
|---|---|---|---|---|---|
body | readonly | AST | null | - | - | - |
generics | readonly | readonly string[] | - | - | - |
kind | readonly | "fn" | - | ASTNode.kind | - |
params | readonly | readonly FnParam[] | - | - | - |
returnType | readonly | AST | - | - | - |
source? | public | SourceRange | Original source range. Mutable on construction (the parser stamps it after building the node). Builder-produced nodes leave it undefined and print() falls through to structural rendering. | - | ASTNode.source |
trivia? | readonly | Trivia | - | - | ASTNode.trivia |
Methods
meta()
meta(
content):MetaAST
Defined in: types.ts:78
Attach metadata to this node. Returns a new MetaAST wrapping the current expression with a record of the given fields. Plain JS values in the content map are auto-lifted to LitAST.
Parameters
| Parameter | Type |
|---|---|
content | MetaContent |
Returns
Inherited from
print()
print():
string
Defined in: types.ts:92
Render this AST back to Glisp source. If a source range is stamped, returns the original text verbatim — preserving comments and the exact whitespace layout. Otherwise delegates to printStructural, which each subclass overrides for builder-style emission.
Returns
string
Inherited from
printStructural()
printStructural():
string
Defined in: types.ts:398
Builder-style rendering. Used when no source range is attached.
Returns
string
Overrides
withBody()
withBody(
expr):FnAST
Defined in: types.ts:394
Return a new FnAST with the given body expression (turns a function type into a function literal).
Parameters
| Parameter | Type |
|---|---|
expr | AST |
Returns
withGenerics()
withGenerics(…
names):FnAST
Defined in: types.ts:388
Return a new FnAST with the given generic-parameter names.
Parameters
| Parameter | Type |
|---|---|
…names | string[] |
Returns
HostAST
Defined in: types.ts:162
AST node carrying a host-side value verbatim. Used by the host API to surface values that the source language cannot otherwise express: type values (number, _, …), typed host fns (+, *, …), IO actions, and the like. Evaluating a HostAST yields its value unchanged.
print() cannot round-trip a host value back to source — instead it shows a sensible label (the type’s name for type values, <host-fn> for typed host fns, <host-value> otherwise). For idempotent display of bound names, callers should prefer toAst which looks the value up in env and returns the bound symbol when available.
Extends
Constructors
Constructor
new HostAST(
value):HostAST
Defined in: types.ts:164
Parameters
| Parameter | Type |
|---|---|
value | unknown |
Returns
Overrides
Properties
| Property | Modifier | Type | Description | Overrides | Inherited from |
|---|---|---|---|---|---|
kind | readonly | "host" | - | ASTNode.kind | - |
source? | public | SourceRange | Original source range. Mutable on construction (the parser stamps it after building the node). Builder-produced nodes leave it undefined and print() falls through to structural rendering. | - | ASTNode.source |
trivia? | readonly | Trivia | - | - | ASTNode.trivia |
value | readonly | unknown | - | - | - |
Methods
meta()
meta(
content):MetaAST
Defined in: types.ts:78
Attach metadata to this node. Returns a new MetaAST wrapping the current expression with a record of the given fields. Plain JS values in the content map are auto-lifted to LitAST.
Parameters
| Parameter | Type |
|---|---|
content | MetaContent |
Returns
Inherited from
print()
print():
string
Defined in: types.ts:92
Render this AST back to Glisp source. If a source range is stamped, returns the original text verbatim — preserving comments and the exact whitespace layout. Otherwise delegates to printStructural, which each subclass overrides for builder-style emission.
Returns
string
Inherited from
printStructural()
printStructural():
string
Defined in: types.ts:168
Builder-style rendering. Used when no source range is attached.
Returns
string
Overrides
LetAST
Defined in: types.ts:328
Let-block {name = expr ... body}. Bindings are self-referential (any binding may reference any other by name, in any order, which supports recursive definitions). body is the trailing expression whose value the block reduces to; body: null means the block itself is the record of bindings.
Extends
Constructors
Constructor
new LetAST(
bindings,body):LetAST
Defined in: types.ts:330
Parameters
| Parameter | Type |
|---|---|
bindings | readonly readonly [string, AST][] |
body | AST | null |
Returns
Overrides
Properties
| Property | Modifier | Type | Description | Overrides | Inherited from |
|---|---|---|---|---|---|
bindings | readonly | readonly readonly [string, AST][] | - | - | - |
body | readonly | AST | null | - | - | - |
kind | readonly | "let" | - | ASTNode.kind | - |
source? | public | SourceRange | Original source range. Mutable on construction (the parser stamps it after building the node). Builder-produced nodes leave it undefined and print() falls through to structural rendering. | - | ASTNode.source |
trivia? | readonly | Trivia | - | - | ASTNode.trivia |
Methods
meta()
meta(
content):MetaAST
Defined in: types.ts:78
Attach metadata to this node. Returns a new MetaAST wrapping the current expression with a record of the given fields. Plain JS values in the content map are auto-lifted to LitAST.
Parameters
| Parameter | Type |
|---|---|
content | MetaContent |
Returns
Inherited from
print()
print():
string
Defined in: types.ts:92
Render this AST back to Glisp source. If a source range is stamped, returns the original text verbatim — preserving comments and the exact whitespace layout. Otherwise delegates to printStructural, which each subclass overrides for builder-style emission.
Returns
string
Inherited from
printStructural()
printStructural():
string
Defined in: types.ts:337
Builder-style rendering. Used when no source range is attached.
Returns
string
Overrides
LitAST
Defined in: types.ts:134
AST node for a primitive literal: number, string, boolean, or unit (()). Evaluates to its value unchanged.
Extends
Constructors
Constructor
new LitAST(
value):LitAST
Defined in: types.ts:136
Parameters
| Parameter | Type |
|---|---|
value | string | number | boolean | typeof UNIT |
Returns
Overrides
Properties
| Property | Modifier | Type | Description | Overrides | Inherited from |
|---|---|---|---|---|---|
kind | readonly | "lit" | - | ASTNode.kind | - |
source? | public | SourceRange | Original source range. Mutable on construction (the parser stamps it after building the node). Builder-produced nodes leave it undefined and print() falls through to structural rendering. | - | ASTNode.source |
trivia? | readonly | Trivia | - | - | ASTNode.trivia |
value | readonly | string | number | boolean | typeof UNIT | - | - | - |
Methods
meta()
meta(
content):MetaAST
Defined in: types.ts:78
Attach metadata to this node. Returns a new MetaAST wrapping the current expression with a record of the given fields. Plain JS values in the content map are auto-lifted to LitAST.
Parameters
| Parameter | Type |
|---|---|
content | MetaContent |
Returns
Inherited from
print()
print():
string
Defined in: types.ts:92
Render this AST back to Glisp source. If a source range is stamped, returns the original text verbatim — preserving comments and the exact whitespace layout. Otherwise delegates to printStructural, which each subclass overrides for builder-style emission.
Returns
string
Inherited from
printStructural()
printStructural():
string
Defined in: types.ts:140
Builder-style rendering. Used when no source range is attached.
Returns
string
Overrides
MetaAST
Defined in: types.ts:512
Metadata-attached expression ^{...} expr. Field is metadata (not meta) to avoid clashing with the .meta() method.
Extends
Constructors
Constructor
new MetaAST(
metadata,expr):MetaAST
Defined in: types.ts:514
Parameters
| Parameter | Type |
|---|---|
metadata | RecordAST |
expr | AST |
Returns
Overrides
Properties
| Property | Modifier | Type | Description | Overrides | Inherited from |
|---|---|---|---|---|---|
expr | readonly | AST | - | - | - |
kind | readonly | "meta" | - | ASTNode.kind | - |
metadata | readonly | RecordAST | - | - | - |
source? | public | SourceRange | Original source range. Mutable on construction (the parser stamps it after building the node). Builder-produced nodes leave it undefined and print() falls through to structural rendering. | - | ASTNode.source |
trivia? | readonly | Trivia | - | - | ASTNode.trivia |
Methods
meta()
meta(
content):MetaAST
Defined in: types.ts:78
Attach metadata to this node. Returns a new MetaAST wrapping the current expression with a record of the given fields. Plain JS values in the content map are auto-lifted to LitAST.
Parameters
| Parameter | Type |
|---|---|
content | MetaContent |
Returns
Inherited from
print()
print():
string
Defined in: types.ts:92
Render this AST back to Glisp source. If a source range is stamped, returns the original text verbatim — preserving comments and the exact whitespace layout. Otherwise delegates to printStructural, which each subclass overrides for builder-style emission.
Returns
string
Inherited from
printStructural()
printStructural():
string
Defined in: types.ts:521
Builder-style rendering. Used when no source range is attached.
Returns
string
Overrides
PathAST
Defined in: types.ts:426
Path atom. A path is a sequence of segments separated by /. Each segment is '..' (go up to parent), a name (descend into a named child), or an integer index (descend into a positional child).
./foo → segments: [‘foo’] …/foo → segments: [‘…’, ‘foo’] …/…/foo → segments: [‘…’, ‘…’, ‘foo’] …/foo/bar → segments: [‘…’, ‘foo’, ‘bar’] ./ → segments: []
Distinguishing path from spread (...): a path always begins with ./ or ../ and contains a /. ...xs (no slash) is a spread.
Extends
Constructors
Constructor
new PathAST(
segments):PathAST
Defined in: types.ts:428
Parameters
| Parameter | Type |
|---|---|
segments | readonly (string | number)[] |
Returns
Overrides
Properties
| Property | Modifier | Type | Description | Overrides | Inherited from |
|---|---|---|---|---|---|
kind | readonly | "path" | - | ASTNode.kind | - |
segments | readonly | readonly (string | number)[] | - | - | - |
source? | public | SourceRange | Original source range. Mutable on construction (the parser stamps it after building the node). Builder-produced nodes leave it undefined and print() falls through to structural rendering. | - | ASTNode.source |
trivia? | readonly | Trivia | - | - | ASTNode.trivia |
Methods
meta()
meta(
content):MetaAST
Defined in: types.ts:78
Attach metadata to this node. Returns a new MetaAST wrapping the current expression with a record of the given fields. Plain JS values in the content map are auto-lifted to LitAST.
Parameters
| Parameter | Type |
|---|---|
content | MetaContent |
Returns
Inherited from
print()
print():
string
Defined in: types.ts:92
Render this AST back to Glisp source. If a source range is stamped, returns the original text verbatim — preserving comments and the exact whitespace layout. Otherwise delegates to printStructural, which each subclass overrides for builder-style emission.
Returns
string
Inherited from
printStructural()
printStructural():
string
Defined in: types.ts:434
Builder-style rendering. Used when no source range is attached.
Returns
string
Overrides
QuoteAST
Defined in: types.ts:448
Quasiquote: `expr. expr is treated as data, not evaluated, except where an UnquoteAST (~expr) or SpliceAST (...~expr) pops the quote level back. See eval.md — Quasiquoted forms.
Extends
Constructors
Constructor
new QuoteAST(
expr):QuoteAST
Defined in: types.ts:450
Parameters
| Parameter | Type |
|---|---|
expr | AST |
Returns
Overrides
Properties
| Property | Modifier | Type | Description | Overrides | Inherited from |
|---|---|---|---|---|---|
expr | readonly | AST | - | - | - |
kind | readonly | "quote" | - | ASTNode.kind | - |
source? | public | SourceRange | Original source range. Mutable on construction (the parser stamps it after building the node). Builder-produced nodes leave it undefined and print() falls through to structural rendering. | - | ASTNode.source |
trivia? | readonly | Trivia | - | - | ASTNode.trivia |
Methods
meta()
meta(
content):MetaAST
Defined in: types.ts:78
Attach metadata to this node. Returns a new MetaAST wrapping the current expression with a record of the given fields. Plain JS values in the content map are auto-lifted to LitAST.
Parameters
| Parameter | Type |
|---|---|
content | MetaContent |
Returns
Inherited from
print()
print():
string
Defined in: types.ts:92
Render this AST back to Glisp source. If a source range is stamped, returns the original text verbatim — preserving comments and the exact whitespace layout. Otherwise delegates to printStructural, which each subclass overrides for builder-style emission.
Returns
string
Inherited from
printStructural()
printStructural():
string
Defined in: types.ts:454
Builder-style rendering. Used when no source range is attached.
Returns
string
Overrides
RecordAST
Defined in: types.ts:281
Record literal. Fields are stored as an ordered array of entries — pair fields and spread elements coexist in source order. Duplicate keys (after spreads have been expanded by eval) reduce with last-wins semantics and emit a diagnostic (see syntax.md — Duplicate names).
Extends
Constructors
Constructor
new RecordAST(
fields,optional?):RecordAST
Defined in: types.ts:283
Parameters
| Parameter | Type |
|---|---|
fields | readonly RecordEntry[] |
optional? | ReadonlySet<string> |
Returns
Overrides
Properties
| Property | Modifier | Type | Description | Overrides | Inherited from |
|---|---|---|---|---|---|
fields | readonly | readonly RecordEntry[] | - | - | - |
kind | readonly | "record" | - | ASTNode.kind | - |
optional? | readonly | ReadonlySet<string> | - | - | - |
source? | public | SourceRange | Original source range. Mutable on construction (the parser stamps it after building the node). Builder-produced nodes leave it undefined and print() falls through to structural rendering. | - | ASTNode.source |
trivia? | readonly | Trivia | - | - | ASTNode.trivia |
Methods
get()
get(
key):AST|undefined
Defined in: types.ts:296
Look up a statically declared field by name, applying last-wins for duplicate pairs. Spread entries are ignored — they require runtime evaluation to resolve. Returns undefined if the key is absent at the literal level.
Parameters
| Parameter | Type |
|---|---|
key | string |
Returns
AST | undefined
meta()
meta(
content):MetaAST
Defined in: types.ts:78
Attach metadata to this node. Returns a new MetaAST wrapping the current expression with a record of the given fields. Plain JS values in the content map are auto-lifted to LitAST.
Parameters
| Parameter | Type |
|---|---|
content | MetaContent |
Returns
Inherited from
print()
print():
string
Defined in: types.ts:92
Render this AST back to Glisp source. If a source range is stamped, returns the original text verbatim — preserving comments and the exact whitespace layout. Otherwise delegates to printStructural, which each subclass overrides for builder-style emission.
Returns
string
Inherited from
printStructural()
printStructural():
string
Defined in: types.ts:306
Builder-style rendering. Used when no source range is attached.
Returns
string
Overrides
SpliceAST
Defined in: types.ts:497
Unquote-splice: ...~expr. Only meaningful inside a quasiquote — evaluates expr (popping the quote level) and splices the resulting elements into the surrounding form.
Extends
Constructors
Constructor
new SpliceAST(
expr):SpliceAST
Defined in: types.ts:499
Parameters
| Parameter | Type |
|---|---|
expr | AST |
Returns
Overrides
Properties
| Property | Modifier | Type | Description | Overrides | Inherited from |
|---|---|---|---|---|---|
expr | readonly | AST | - | - | - |
kind | readonly | "splice" | - | ASTNode.kind | - |
source? | public | SourceRange | Original source range. Mutable on construction (the parser stamps it after building the node). Builder-produced nodes leave it undefined and print() falls through to structural rendering. | - | ASTNode.source |
trivia? | readonly | Trivia | - | - | ASTNode.trivia |
Methods
meta()
meta(
content):MetaAST
Defined in: types.ts:78
Attach metadata to this node. Returns a new MetaAST wrapping the current expression with a record of the given fields. Plain JS values in the content map are auto-lifted to LitAST.
Parameters
| Parameter | Type |
|---|---|
content | MetaContent |
Returns
Inherited from
print()
print():
string
Defined in: types.ts:92
Render this AST back to Glisp source. If a source range is stamped, returns the original text verbatim — preserving comments and the exact whitespace layout. Otherwise delegates to printStructural, which each subclass overrides for builder-style emission.
Returns
string
Inherited from
printStructural()
printStructural():
string
Defined in: types.ts:503
Builder-style rendering. Used when no source range is attached.
Returns
string
Overrides
SpreadAST
Defined in: types.ts:481
Spread: ...expr. Inlines the operand’s elements into the surrounding call / vector / record / quasiquote. Stays as ...expr regardless of whether it appears inside a quasiquote — for the quasiquote-specific “evaluate and splice” form, use SpliceAST (...~expr).
Extends
Constructors
Constructor
new SpreadAST(
expr):SpreadAST
Defined in: types.ts:483
Parameters
| Parameter | Type |
|---|---|
expr | AST |
Returns
Overrides
Properties
| Property | Modifier | Type | Description | Overrides | Inherited from |
|---|---|---|---|---|---|
expr | readonly | AST | - | - | - |
kind | readonly | "spread" | - | ASTNode.kind | - |
source? | public | SourceRange | Original source range. Mutable on construction (the parser stamps it after building the node). Builder-produced nodes leave it undefined and print() falls through to structural rendering. | - | ASTNode.source |
trivia? | readonly | Trivia | - | - | ASTNode.trivia |
Methods
meta()
meta(
content):MetaAST
Defined in: types.ts:78
Attach metadata to this node. Returns a new MetaAST wrapping the current expression with a record of the given fields. Plain JS values in the content map are auto-lifted to LitAST.
Parameters
| Parameter | Type |
|---|---|
content | MetaContent |
Returns
Inherited from
print()
print():
string
Defined in: types.ts:92
Render this AST back to Glisp source. If a source range is stamped, returns the original text verbatim — preserving comments and the exact whitespace layout. Otherwise delegates to printStructural, which each subclass overrides for builder-style emission.
Returns
string
Inherited from
printStructural()
printStructural():
string
Defined in: types.ts:487
Builder-style rendering. Used when no source range is attached.
Returns
string
Overrides
SymAST
Defined in: types.ts:193
AST node for a bare identifier. Evaluation looks name up in the current env’s binding chain (see eval.md — name resolution). Special-form heads like ?, |>, def, @ arrive here too and are dispatched by name, not by lookup.
Extends
Constructors
Constructor
new SymAST(
name):SymAST
Defined in: types.ts:195
Parameters
| Parameter | Type |
|---|---|
name | string |
Returns
Overrides
Properties
| Property | Modifier | Type | Description | Overrides | Inherited from |
|---|---|---|---|---|---|
kind | readonly | "sym" | - | ASTNode.kind | - |
name | readonly | string | - | - | - |
source? | public | SourceRange | Original source range. Mutable on construction (the parser stamps it after building the node). Builder-produced nodes leave it undefined and print() falls through to structural rendering. | - | ASTNode.source |
trivia? | readonly | Trivia | - | - | ASTNode.trivia |
Methods
meta()
meta(
content):MetaAST
Defined in: types.ts:78
Attach metadata to this node. Returns a new MetaAST wrapping the current expression with a record of the given fields. Plain JS values in the content map are auto-lifted to LitAST.
Parameters
| Parameter | Type |
|---|---|
content | MetaContent |
Returns
Inherited from
print()
print():
string
Defined in: types.ts:92
Render this AST back to Glisp source. If a source range is stamped, returns the original text verbatim — preserving comments and the exact whitespace layout. Otherwise delegates to printStructural, which each subclass overrides for builder-style emission.
Returns
string
Inherited from
printStructural()
printStructural():
string
Defined in: types.ts:199
Builder-style rendering. Used when no source range is attached.
Returns
string
Overrides
UnquoteAST
Defined in: types.ts:464
Unquote: ~expr inside a quasiquote. Pops one quote level so the inner expression evaluates in the surrounding env. Outside a quasiquote, an unquote is a parse-time error.
Extends
Constructors
Constructor
new UnquoteAST(
expr):UnquoteAST
Defined in: types.ts:466
Parameters
| Parameter | Type |
|---|---|
expr | AST |
Returns
Overrides
Properties
| Property | Modifier | Type | Description | Overrides | Inherited from |
|---|---|---|---|---|---|
expr | readonly | AST | - | - | - |
kind | readonly | "unquote" | - | ASTNode.kind | - |
source? | public | SourceRange | Original source range. Mutable on construction (the parser stamps it after building the node). Builder-produced nodes leave it undefined and print() falls through to structural rendering. | - | ASTNode.source |
trivia? | readonly | Trivia | - | - | ASTNode.trivia |
Methods
meta()
meta(
content):MetaAST
Defined in: types.ts:78
Attach metadata to this node. Returns a new MetaAST wrapping the current expression with a record of the given fields. Plain JS values in the content map are auto-lifted to LitAST.
Parameters
| Parameter | Type |
|---|---|
content | MetaContent |
Returns
Inherited from
print()
print():
string
Defined in: types.ts:92
Render this AST back to Glisp source. If a source range is stamped, returns the original text verbatim — preserving comments and the exact whitespace layout. Otherwise delegates to printStructural, which each subclass overrides for builder-style emission.
Returns
string
Inherited from
printStructural()
printStructural():
string
Defined in: types.ts:470
Builder-style rendering. Used when no source range is attached.
Returns
string
Overrides
VecAST
Defined in: types.ts:257
Vector literal [e0 e1 ...]. Evaluation produces a JS array; spread elements (...xs) are flattened by the evaluator at this position. In type position, a [T1 T2 ...Trest] shape is read as a tuple type (see types.md).
Extends
Constructors
Constructor
new VecAST(
elements):VecAST
Defined in: types.ts:259
Parameters
| Parameter | Type |
|---|---|
elements | readonly AST[] |
Returns
Overrides
Properties
| Property | Modifier | Type | Description | Overrides | Inherited from |
|---|---|---|---|---|---|
elements | readonly | readonly AST[] | - | - | - |
kind | readonly | "vec" | - | ASTNode.kind | - |
source? | public | SourceRange | Original source range. Mutable on construction (the parser stamps it after building the node). Builder-produced nodes leave it undefined and print() falls through to structural rendering. | - | ASTNode.source |
trivia? | readonly | Trivia | - | - | ASTNode.trivia |
Methods
meta()
meta(
content):MetaAST
Defined in: types.ts:78
Attach metadata to this node. Returns a new MetaAST wrapping the current expression with a record of the given fields. Plain JS values in the content map are auto-lifted to LitAST.
Parameters
| Parameter | Type |
|---|---|
content | MetaContent |
Returns
Inherited from
print()
print():
string
Defined in: types.ts:92
Render this AST back to Glisp source. If a source range is stamped, returns the original text verbatim — preserving comments and the exact whitespace layout. Otherwise delegates to printStructural, which each subclass overrides for builder-style emission.
Returns
string
Inherited from
printStructural()
printStructural():
string
Defined in: types.ts:263
Builder-style rendering. Used when no source range is attached.
Returns
string
Overrides
Interfaces
BindingTarget
Defined in: types.ts:608
Properties
| Property | Modifier | Type | Description |
|---|---|---|---|
ast | readonly | AST | - |
env | readonly | Env | - |
type? | readonly | unknown | Optional declared type for this binding — typically a function parameter’s declared type, eagerly evaluated when the closure was applied. When set, the evaluator casts the resolved value through this type at force time, driving the spec’s “default fallback at typed slots” behavior for closures. The shape is TypeValue (defined in eval.ts) but it lives here as unknown to avoid a circular import — the evaluator’s isTypeValue brand check narrows it back at use sites. |
Diagnostic
Defined in: types.ts:637
One error / warning / info entry produced by evaluate, check, or infer. The source pinpoints the offending AST node and the env it was evaluated against, so a host can show the message in context.
Properties
| Property | Modifier | Type |
|---|---|---|
level | readonly | DiagnosticLevel |
message | readonly | string |
source | readonly | EvaluationNode |
EvaluationNode
Defined in: types.ts:649
The site at which a diagnostic was raised: an (ast, env) pair. The same AST node can be evaluated under different envs (a function called twice from different scopes), so both halves are needed to locate the diagnostic precisely.
Properties
| Property | Modifier | Type |
|---|---|---|
ast | readonly | AST |
env | readonly | Env |
FnParam
Defined in: types.ts:354
One parameter slot in a FnAST signature: a name, a declared type (as an AST that is evaluated in the function’s captured env), and the optional?: / ...rest markers from source.
Properties
| Property | Modifier | Type |
|---|---|---|
name | readonly | string |
optional? | readonly | boolean |
type | readonly | AST |
variadic? | readonly | boolean |
Frame
Defined in: types.ts:602
A single frame in the env chain.
Properties
| Property | Modifier | Type |
|---|---|---|
ast | readonly | AST |
bindings? | readonly | ReadonlyMap<string, BindingTarget> |
parent | readonly | Env |
SourceRange
Defined in: types.ts:52
Source-range stamp used to round-trip a parsed AST verbatim. The parser sets this on every node it produces; builder-constructed nodes leave it unset and fall back to structural rendering. The same text reference is shared across all nodes from one parse() call.
Properties
| Property | Modifier | Type |
|---|---|---|
end | readonly | number |
start | readonly | number |
text | readonly | string |
Type Aliases
AST
AST =
LitAST|HostAST|SymAST|CallAST|AccessAST|VecAST|RecordAST|LetAST|FnAST|PathAST|QuoteAST|UnquoteAST|SpreadAST|SpliceAST|MetaAST
Defined in: types.ts:113
Discriminated union of every AST node kind. Narrow with the is* predicates below or with a switch (ast.kind) over the literal kind field on each variant.
DiagnosticLevel
DiagnosticLevel =
"error"|"warning"|"info"
Defined in: types.ts:630
Severity tag attached to a diagnostic.
Diagnostics
Diagnostics =
ReadonlySet<Diagnostic>
Defined in: types.ts:658
Read-only collection of diagnostics. Used by APIs that aggregate diagnostics across many call sites (e.g. check).
Env
Env =
Frame|null
Defined in: types.ts:597
An environment is a chain of frames, each describing one level of enclosing scope (and providing the ancestor structure that path navigation walks). null is the root sentinel above top-level.
MetaContent
MetaContent =
Readonly<Record<string,MetaFieldValue>>
Defined in: types.ts:44
MetaFieldValue
Defined in: types.ts:43
Values accepted by the .meta(...) method: AST nodes, or JS primitives that are auto-lifted to LitAST.
RecordEntry
Defined in: types.ts:273
One entry inside a record literal. Either a [name, value] pair (a normal field), or a SpreadAST (a ...rec element that merges another record’s fields at this position).
Trivia
Trivia =
ReadonlyArray<string>
Defined in: types.ts:37
Inter-position trivia (whitespace, comments) attached to each AST node. Slot count and stickiness rules per node type are documented in eval.md.
Builder-constructed ASTs have no trivia; parse-constructed ASTs preserve it.
Unit
Unit = typeof
UNIT
Defined in: types.ts:25
Variables
UNIT
constUNIT: uniquesymbol
Defined in: types.ts:24
The Glisp unit value. Distinguished from null/undefined via a registered Symbol so it survives module boundaries and can never collide with JS-native absence values.
Functions
isAccess()
isAccess(
a):a is AccessAST
Defined in: types.ts:576
Parameters
| Parameter | Type |
|---|---|
a | AST |
Returns
a is AccessAST
isCall()
isCall(
a):a is CallAST
Defined in: types.ts:575
Parameters
| Parameter | Type |
|---|---|
a | AST |
Returns
a is CallAST
isFn()
isFn(
a):a is FnAST
Defined in: types.ts:580
Parameters
| Parameter | Type |
|---|---|
a | AST |
Returns
a is FnAST
isHost()
isHost(
a):a is HostAST
Defined in: types.ts:573
Parameters
| Parameter | Type |
|---|---|
a | AST |
Returns
a is HostAST
isLet()
isLet(
a):a is LetAST
Defined in: types.ts:579
Parameters
| Parameter | Type |
|---|---|
a | AST |
Returns
a is LetAST
isLit()
isLit(
a):a is LitAST
Defined in: types.ts:572
Type-predicate narrowers over the AST union. Each is equivalent to ast.kind === '...' but is written as a TS type-predicate so callers can compose them with Array.filter, Array.find, and similar.
Parameters
| Parameter | Type |
|---|---|
a | AST |
Returns
a is LitAST
isMeta()
isMeta(
a):a is MetaAST
Defined in: types.ts:586
Parameters
| Parameter | Type |
|---|---|
a | AST |
Returns
a is MetaAST
isPath()
isPath(
a):a is PathAST
Defined in: types.ts:581
Parameters
| Parameter | Type |
|---|---|
a | AST |
Returns
a is PathAST
isQuote()
isQuote(
a):a is QuoteAST
Defined in: types.ts:582
Parameters
| Parameter | Type |
|---|---|
a | AST |
Returns
a is QuoteAST
isRecord()
isRecord(
a):a is RecordAST
Defined in: types.ts:578
Parameters
| Parameter | Type |
|---|---|
a | AST |
Returns
a is RecordAST
isSplice()
isSplice(
a):a is SpliceAST
Defined in: types.ts:585
Parameters
| Parameter | Type |
|---|---|
a | AST |
Returns
a is SpliceAST
isSpread()
isSpread(
a):a is SpreadAST
Defined in: types.ts:584
Parameters
| Parameter | Type |
|---|---|
a | AST |
Returns
a is SpreadAST
isSym()
isSym(
a):a is SymAST
Defined in: types.ts:574
Parameters
| Parameter | Type |
|---|---|
a | AST |
Returns
a is SymAST
isUnquote()
isUnquote(
a):a is UnquoteAST
Defined in: types.ts:583
Parameters
| Parameter | Type |
|---|---|
a | AST |
Returns
a is UnquoteAST
isVec()
isVec(
a):a is VecAST
Defined in: types.ts:577
Parameters
| Parameter | Type |
|---|---|
a | AST |
Returns
a is VecAST