Our budding (currently internal) API deals with building information models, originates in our main application written in c++.

There is a small implementation of it in C# for easy interop with other CAD software exposing .Net APIs (mainly just a class library with de/serialization). This also covers python scripting through python.net.

We reached a point where it would also be useful to have a small Typescript implementation as well for use in web-gl based in-browser viewer app. (We tried unity with our C# API, but the non-packing GC that comes with IL2CPP turned out to be a hard limit in our use case, runtime generating and regenerating huge meshes based on user input).

Now, for just the "class library" part code generation is doable, where we parse the c++ classes and autogenerate POCs in the other languages. This makes sure at least our representation of the data is in sync across all theatres.

Problem is, if we wish to lift some logic into the API libraries like validation, the parse and generate method complexity increases exponentially, especially through diverse languages like c++, c# and js.

I currently see 3 paths forward:

 1. Write the logic in only 1 language and hack it into the other environments (c++/il wrapper for C# and Emscripten for JS land). This works but introduces too many bottlenecks.
 2. Write the logic in some common easy to parse and sufficiently vague DSL from which it is easy to generate all 3 languages. I haven't found a good already existing solution to this, rolling our own seems prohibitively time consuming.
 3. Write the logic separately in all 3 languages utilizing each language to the fullest, ensure parity through rigorous testing with specification written in a common DSL (With something like Cucumber and Gherkin?) This is also time consuming, but we already spend time on testing which would be reallocated here.

What are the experiences with these strategies? Are there other major patterns for this?

Currently number 3 seems like the most promising, maybe because I have the least experience in it and of its pain points. Are there other / better frameworks for this than Cucumber/Gherkin?