Skip to content

(feat) AST -> HIR<TypedSpan> Conversion #54

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 23 commits into from
Apr 5, 2025
Merged

Conversation

AlSchlo
Copy link
Collaborator

@AlSchlo AlSchlo commented Apr 4, 2025

Implements the first pass of AST->HIR conversion in analyzer/from_ast.

In addition to obtaining a HIR<TypedSpan>, the conversion process:

  1. Desugars syntax.
  2. Builds the ADT type registry.
  3. Ingests explicit type annotations.

You may experiment with it as follows:
cargo run -- compile examples/example.dsl --print-ast --print-hir

Add map in HIR

Add missing file

Finish implementation of Map

Integrate hashable maps

Enrich call evaluate

Add nothing type

Almost done with engine operator field accesses

Add logical & physical operator testing

Rename nothing type into never

Add metadata to Value

Add try bind in context

Add linked & unlinked UDF

Preliminary from_ast conversion

Add annotation support

Advance more in conversation
@AlSchlo AlSchlo force-pushed the alexis/ast-to-hir-2 branch from 6cee0d4 to 5c18333 Compare April 4, 2025 00:24
@codecov-commenter
Copy link

codecov-commenter commented Apr 4, 2025

Codecov Report

Attention: Patch coverage is 86.18785% with 225 lines in your changes missing coverage. Please review.

Project coverage is 76.9%. Comparing base (ed35467) to head (2a93aab).

Files with missing lines Patch % Lines
optd-dsl/src/cli/main.rs 0.0% 61 Missing ⚠️
optd-dsl/src/analyzer/semantic_check/error.rs 23.9% 54 Missing ⚠️
optd-dsl/src/analyzer/from_ast/expr.rs 93.1% 42 Missing ⚠️
optd-dsl/src/analyzer/from_ast/types.rs 88.5% 19 Missing ⚠️
optd-dsl/src/analyzer/from_ast/pattern.rs 89.6% 15 Missing ⚠️
optd-dsl/src/parser/expr.rs 86.6% 10 Missing ⚠️
optd-dsl/src/cli/compile.rs 0.0% 8 Missing ⚠️
optd-dsl/src/analyzer/from_ast/converter.rs 97.8% 7 Missing ⚠️
optd-dsl/src/analyzer/hir.rs 89.2% 6 Missing ⚠️
optd-dsl/src/analyzer/types.rs 90.9% 2 Missing ⚠️
... and 1 more
Additional details and impacted files
Files with missing lines Coverage Δ
optd-dsl/src/analyzer/context.rs 85.4% <100.0%> (+10.4%) ⬆️
optd-dsl/src/analyzer/type_check/error.rs 0.0% <ø> (ø)
optd-dsl/src/engine/eval/expr.rs 97.7% <100.0%> (+<0.1%) ⬆️
optd-dsl/src/engine/eval/match.rs 99.3% <100.0%> (+<0.1%) ⬆️
optd-dsl/src/parser/module.rs 100.0% <100.0%> (ø)
optd-dsl/src/utils/error.rs 25.0% <ø> (ø)
optd-dsl/src/utils/span.rs 71.4% <100.0%> (+2.1%) ⬆️
optd-dsl/src/utils/tests.rs 91.1% <100.0%> (ø)
optd-dsl/src/engine/mod.rs 55.7% <0.0%> (-0.9%) ⬇️
optd-dsl/src/analyzer/types.rs 98.4% <90.9%> (ø)
... and 9 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@AlSchlo AlSchlo changed the title Alexis/ast to hir 2 (feat) AST -> HIR<TypedSpan> Conversion Apr 5, 2025
@AlSchlo AlSchlo marked this pull request as ready for review April 5, 2025 15:16
Copy link
Member

@connortsui20 connortsui20 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have time to read through all of the matching code, so I focused on just the type design.

Other than the stuff I mentioned about errors (and on slack about immutable contexts instead of a stack of history for every single context), everything generally looks good to me. I think the UDFs setup is a bit strange but given that you have nothing to work with yet (I still have to write all of the E2E structure for that) I think this is fine to merge and we can fix that later.

Copy link
Member

@yliang412 yliang412 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work!

@AlSchlo AlSchlo merged commit 7201885 into main Apr 5, 2025
11 checks passed
@AlSchlo AlSchlo deleted the alexis/ast-to-hir-2 branch April 5, 2025 20:04
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.

5 participants