Though it is not straight forward to create performant code at the end. But we might investigate to export a list of snippets in a first step.
Also, IMHO a high level abstraction would be preferred when porting/coding said logic to another programming language.
Though it is not straight forward to create performant code at the end. But we might investigate to export a list of snippets in a first step.