The cleanest way of doing this would be to introduce general binary operations by generalizing IntExp to be Exp and tailor math expression reducer accordingly but that would be too intrusive for such a small feature we are adding now. Instead, i created StringExp in the grammar, similarly to IntExp and reused the existing math expression reducer.
Removed some unnecessary case branches in the reducer after talking to everyone and so we are confident they are not necessary.
Implemented
+
operator for stringsIt is possible now to write:
Implementation details
The cleanest way of doing this would be to introduce general binary operations by generalizing
IntExp
to beExp
and tailor math expression reducer accordingly but that would be too intrusive for such a small feature we are adding now. Instead, i createdStringExp
in the grammar, similarly toIntExp
and reused the existing math expression reducer.Removed some unnecessary case branches in the reducer after talking to everyone and so we are confident they are not necessary.