generating valid scala code