such as MinusEquals, PlusEquals, etc.
What feels right to me, would be a preprocessor which would e.g. consume i += 1 and produce i = i + (1) (the parenthesis are to ensure an arbitrary expression for the rhs gets evaluated before infix operating with the i). This would mean the general parser would only have to handle Equals for assignment.
The problem with wrapping the rhs in parens means it would have to consume all tokens until the expression ends, which means it has to know how to parse expressions. We may (?) be able to separate expression parsing from the parser impl first, since an expression shouldn't need to depend on any program state, like indentation or context.
such as MinusEquals, PlusEquals, etc.
What feels right to me, would be a preprocessor which would e.g. consume
i += 1and producei = i + (1)(the parenthesis are to ensure an arbitrary expression for the rhs gets evaluated before infix operating with thei). This would mean the general parser would only have to handle Equals for assignment.The problem with wrapping the rhs in parens means it would have to consume all tokens until the expression ends, which means it has to know how to parse expressions. We may (?) be able to separate expression parsing from the parser impl first, since an expression shouldn't need to depend on any program state, like indentation or context.