Skip to content

Include Spans on internal parser AST objects#100

Merged
istathar merged 9 commits into
technique-lang:mainfrom
istathar:spans
May 7, 2026
Merged

Include Spans on internal parser AST objects#100
istathar merged 9 commits into
technique-lang:mainfrom
istathar:spans

Conversation

@istathar
Copy link
Copy Markdown
Member

@istathar istathar commented May 6, 2026

This is an enormously invasive change to make what seems like a minor improvement, but it is common that parsers produce abstract syntax trees that include information about the range of the the source that they came from.

While the parser itself is stateful and has the source location to hand when it encounters a problem, subsequent phases in the compiler do not have that information and if they want to refer back to the input that caused the problem they need that range information. This is now included in a Span struct on every parser internal AST type.

Also fixes a bug in the ranges being passed to lesser used code paths, so a net improvement in correctness.

@istathar istathar self-assigned this May 6, 2026
@istathar istathar merged commit 99db77c into technique-lang:main May 7, 2026
1 check passed
@istathar istathar deleted the spans branch May 7, 2026 00:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant