Skip to content

core: add syntax tree and URI parser#1886

Merged
brharrington merged 1 commit intoNetflix:mainfrom
brharrington:ast-syntax
Mar 25, 2026
Merged

core: add syntax tree and URI parser#1886
brharrington merged 1 commit intoNetflix:mainfrom
brharrington:ast-syntax

Conversation

@brharrington
Copy link
Copy Markdown
Contributor

Add error-tolerant AST construction for Atlas stack language expressions and a URI parser for graph API endpoints.

Interpreter.syntaxTree builds a syntax tree from an expression string, recovering from errors and collecting diagnostics for each problem. The tree contains position info for all tokens, resolved word references, and stack state at each point.

The URI parser extracts query parameters with precise positional information so the AST and diagnostics can map back to exact positions in the original URI. It handles percent-decoding while maintaining raw-to-decoded offset maps for accurate spans.

New types in stacklang.ast:

  • Token, ValueToken, CommentToken for tokenized input
  • SyntaxNode (LiteralNode, WordNode, ListNode, CommentNode)
  • SyntaxTree container with nodes, diagnostics, and final stack
  • Diagnostic, Severity, Span for error reporting

New types in core.uri:

  • UriParser for parsing graph API URIs with percent-decoding
  • QueryParam with decoded text and raw-to-decoded offset maps

Add error-tolerant AST construction for Atlas stack language
expressions and a URI parser for graph API endpoints.

Interpreter.syntaxTree builds a syntax tree from an expression
string, recovering from errors and collecting diagnostics for
each problem. The tree contains position info for all tokens,
resolved word references, and stack state at each point.

The URI parser extracts query parameters with precise positional
information so the AST and diagnostics can map back to exact
positions in the original URI. It handles percent-decoding while
maintaining raw-to-decoded offset maps for accurate spans.

New types in stacklang.ast:
- Token, ValueToken, CommentToken for tokenized input
- SyntaxNode (LiteralNode, WordNode, ListNode, CommentNode)
- SyntaxTree container with nodes, diagnostics, and final stack
- Diagnostic, Severity, Span for error reporting

New types in core.uri:
- UriParser for parsing graph API URIs with percent-decoding
- QueryParam with decoded text and raw-to-decoded offset maps
@brharrington brharrington added this to the 1.9.0 milestone Mar 25, 2026
@brharrington brharrington merged commit 1c1eb72 into Netflix:main Mar 25, 2026
5 checks passed
@brharrington brharrington deleted the ast-syntax branch March 25, 2026 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant