v4 Parsing
for + loop control parser
forhas optional init / condition / post clausesbreakandcontinueare leaf statements with required;
for header model
for (init; cond; post) { ... }
- parse init without trailing
; - parse condition as optional expression
- parse post as optional expression without trailing
; - require
)and block
precedence ladder
expr -> or -> and -> equality
or -> and ("||" and)* and -> equality ("&&" equality)*
practical checks
for (;;)is legal- missing semicolons are syntax errors at parse boundary
- invalid assignment target in loop init/post is diagnosed by parser
a || b && c || dfollows precedence
parser resilience
- keep diagnostics precise at semicolon / paren boundaries
- synchronize after failed for header to avoid cascading errors
1 / 1