feat(compiler): ternary conditional operator cond ? a : b (Wave 56, R-CG-5)#826
Open
gHashTag wants to merge 2 commits into
Open
feat(compiler): ternary conditional operator cond ? a : b (Wave 56, R-CG-5)#826gHashTag wants to merge 2 commits into
gHashTag wants to merge 2 commits into
Conversation
…#823) Wave 55 adds ExprConcat: {a, b, c} for Verilog bit concatenation. - Verilog: emits {a, b, c} (native concatenation) - C/Rust: emits /* concat(a, b, c) */ 0 (width-aware shift+or deferred) - Parser distinguishes {expr, expr} from struct literal Name{field: val} - Supports nested concatenation {{a, b}, c} 11 new tests (parse, Verilog, C, Rust, nested, assignment, literals). All pass.
…oses #825) Wave 56 adds ExprTernary: cond ? a : b for concise conditional expressions. - Verilog/C/Zig: emit cond ? a : b (native ternary) - Rust: emit if cond { a } else { b } (idiomatic) - Right-associative: a ? x : b ? y : z parses correctly - Works with comparisons: val < lo ? lo : val 9 new tests (parse, 4 backends, nested, assignment, comparison, right-assoc). All pass.
This was referenced May 24, 2026
This was referenced May 24, 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.
Closes #825
Wave 56 — R-CG-5: Ternary conditional operator
cond ? a : bWhat changed
TokenKind::Question+NodeKind::ExprTernary?added to lexer single-char scannercond ? a : bif cond { a } else { b }Example
Test results
9 new tests. All pass.