demetrixbio / GslCore

Core library and basic plug-ins for the Amyris Genotype Specification Language (GSL) compiler.
Apache License 2.0
6 stars 1 forks source link

FEA: String concatenation #13

Closed legezam closed 3 years ago

legezam commented 3 years ago

Implemented + operator for strings

It is possible now to write:

let foo = "bar" + "baz"
let foo = "bar" + &baz

Implementation details

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.

legezam commented 3 years ago

cc @chrismacklin @generalelectrix