You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Parser: flow-audio foundation conformance hits unexpected LBRACE #810
From flooooooooooow/flow-audio, the conformance/foundation.flow case currently reaches the parser and reports:
Unexpected token in expression: TokenType.LBRACE
This surfaced while exercising the package locally via the root-project test/run path. It is distinct from the root-package self-import resolution bug tracked in #803: that issue blocks canonical flow_audio.* imports, while this case is a parser failure after reaching foundation.flow.
Current source audit (2026-08-29)
The current flow-audio/conformance/foundation.flow contains one expression-position typed brace literal that is the strongest minimization target:
The other braces in the file are ordinary function/if blocks. Flow's compiler has an explicit AST_STRUCT_LIT representation and self-host monomorphization support for struct-literal nodes, so this should be treated as a focused parser/front-end compatibility failure rather than assuming brace literals are unsupported wholesale.
Expected behavior
The foundation conformance program should parse normally, or the parser should report the exact unsupported syntax construct with a focused diagnostic.
Next action
Reproduce locally from a clean flow + flow-audio checkout. First reduce the case to a tiny PrepareConfig { ... }-style typed struct literal using the same field syntax. If that reproduces Unexpected ... LBRACE, add the minimized parser regression and compare the production Python parser's struct-literal path with the Stage-A AST_STRUCT_LIT representation before changing grammar behavior. If it does not reproduce, bisect the preceding expression boundary in foundation.flow rather than changing struct-literal parsing speculatively.
Validation is local-only; do not use hosted CI/workflows for qualification.
I minimized the parser boundary behind this failure and archived the derivation + Flow witness in godofecht/OpenProjects.
The important parser smell is in parse_primary(): any Identifier { speculatively enters parse_struct_literal(), catches anySyntaxError, rewinds lexer/token state, and returns the identifier as a variable. That behavior is currently exercised even by normal condition endings such as:
if status != FLOW_AUDIO_OK { return 1 }
because the final identifier is immediately followed by the body brace. The failed speculative struct parse sees return where it expected a field name, swallows the error, then lets parse_if() consume the brace.
The cleaner grammar boundary is context-aware: at top level in an if/while condition, { is a FOLLOW token for the condition and should terminate the expression without attempting a struct literal. In ordinary expression context, Identifier { is committed struct-literal syntax and any inner parse error should propagate instead of being backtracked into a later bare-LBRACE error. Nested expressions reset to ordinary struct-literal-enabled context, so if accepts(Pair { a: 1 }) { ... } remains valid.
I would implement this as a depth-scoped expression context (block_brace_terminates) used by parse_if/parse_while, and remove the catch-and-rewind for Identifier { in ordinary expression context.
Minimal regressions: normal if status == 0 { ... }; valid Pair { a: 1 }; nested struct literal inside a condition; malformed Pair { a = 1 } must diagnose the bad = rather than degrade to Unexpected ... LBRACE.
I cannot claim this is the sole cause of the current foundation failure until the parser is run locally after the change, but it is a definite diagnostic/grammar ownership bug and should either resolve #810 or expose the actual inner unsupported construct cleanly. Validation remains local-only; no hosted workflows.
Activity
godofecht commentedon Aug 27, 2026
I minimized the parser boundary behind this failure and archived the derivation + Flow witness in
godofecht/OpenProjects.The important parser smell is in
parse_primary(): anyIdentifier {speculatively entersparse_struct_literal(), catches anySyntaxError, rewinds lexer/token state, and returns the identifier as a variable. That behavior is currently exercised even by normal condition endings such as:because the final identifier is immediately followed by the body brace. The failed speculative struct parse sees
returnwhere it expected a field name, swallows the error, then letsparse_if()consume the brace.The cleaner grammar boundary is context-aware: at top level in an
if/whilecondition,{is a FOLLOW token for the condition and should terminate the expression without attempting a struct literal. In ordinary expression context,Identifier {is committed struct-literal syntax and any inner parse error should propagate instead of being backtracked into a later bare-LBRACE error. Nested expressions reset to ordinary struct-literal-enabled context, soif accepts(Pair { a: 1 }) { ... }remains valid.I would implement this as a depth-scoped expression context (
block_brace_terminates) used byparse_if/parse_while, and remove the catch-and-rewind forIdentifier {in ordinary expression context.Minimal regressions: normal
if status == 0 { ... }; validPair { a: 1 }; nested struct literal inside a condition; malformedPair { a = 1 }must diagnose the bad=rather than degrade toUnexpected ... LBRACE.I cannot claim this is the sole cause of the current foundation failure until the parser is run locally after the change, but it is a definite diagnostic/grammar ownership bug and should either resolve #810 or expose the actual inner unsupported construct cleanly. Validation remains local-only; no hosted workflows.
test: guard multi-line typed struct literal in expression position (#810