Aiur grammar: statement sequencing t; rest#475
Merged
Conversation
7b0af4d to
49bca62
Compare
Add `syntax:0 aiur_trm "; " (aiur_trm)?` — `f(x); rest` elaborates to `let _ = f(x); rest` (wildcard let, value discarded); trailing `f(x);` closes the block with `()`. Unit-returning calls sit in statement position without the `let _ =` boilerplate. The sequencing rule is the grammar's only prec-0 rule; positions where an expression can end right before a `;` are bumped to prec 1 so it can't leak into expression operands: `let` right-hand sides, `+`/`-` right operands, `return`, array elements/replicate. Without the binop guard, `let x = a - 1; rest` reparses as `a - (1; rest)` — caught only at `ix codegen` scope-check (`unboundGlobal`), not by `lake build`, since elaboration builds Source.Term without checking. All other argument positions are bounded by closing tokens and can't precede a `;`. Since prec-51 positions accept every leading form, default rule prec ≥ 51 and the :1 annotations exclude only the sequencing rule. Rewrite all 113 `let _ = call(...);` sites in Ix/IxVM and the 3 `let _ = store(...)` sites in Tests/Aiur to the new form, and drop the 4 redundant explicit `()` continuations after trailing `assert_eq!` (an omitted continuation already elaborates to unit). Generated kernel is byte-identical after `lake exe ix codegen` (identical IR by construction — no FFT shift), and `lake test -- aiur-cross` passes with the new syntax exercised.
49bca62 to
38f0ee7
Compare
gabriel-barrett
approved these changes
Jul 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add
syntax:0 aiur_trm "; " (aiur_trm)?—f(x); restelaborates tolet _ = f(x); rest(wildcard let, value discarded); trailingf(x);closes the block with
(). Unit-returning calls sit in statementposition without the
let _ =boilerplate.The sequencing rule is the grammar's only prec-0 rule; positions where
an expression can end right before a
;are bumped to prec 1 so itcan't leak into expression operands:
letright-hand sides,+/-right operands,
return, array elements/replicate. Without the binopguard,
let x = a - 1; restreparses asa - (1; rest)— caught onlyat
ix codegenscope-check (unboundGlobal), not bylake build,since elaboration builds Source.Term without checking. All other
argument positions are bounded by closing tokens and can't precede a
;. Since prec-51 positions accept every leading form, default ruleprec ≥ 51 and the :1 annotations exclude only the sequencing rule.
Rewrite all 113
let _ = call(...);sites in Ix/IxVM and the 3let _ = store(...)sites in Tests/Aiur to the new form, and drop the4 redundant explicit
()continuations after trailingassert_eq!(an omitted continuation already elaborates to unit). Generated kernel
is byte-identical after
lake exe ix codegen(identical IR byconstruction — no FFT shift), and
lake test -- aiur-crosspasseswith the new syntax exercised.