Vardecl with implicit type and initializer is difficult to separate from an assignment statement. The LRM grammar is ambiguous and would require some semantic predicate magic to disambiguate.
Rather than doing that I've just relaxed the grammar to allow interleaving declarations and statements and made certain variable declarations (of the form "a = b;") be treated as an assignment statement.
I'm sure this could be handled in the grammar if my antlr-fu was better, but for now it seems easier to handle this in the semantic phase.
Vardecl with implicit type and initializer is difficult to separate from an assignment statement. The LRM grammar is ambiguous and would require some semantic predicate magic to disambiguate.
Rather than doing that I've just relaxed the grammar to allow interleaving declarations and statements and made certain variable declarations (of the form "a = b;") be treated as an assignment statement.
I'm sure this could be handled in the grammar if my antlr-fu was better, but for now it seems easier to handle this in the semantic phase.