Code generation using tree matching and dynamic programming | Synapse