Re:Transpiling between any programming languages (2019)
by geewee on Sunday February 16, 2020 @09:29AM
(#22341675)
This seems like a really hard problem to solve - but it's some pretty cool progress. I do wonder how Mongo decided building a high-level transpiler was worth their time though. Is the business value of translating those queries really that high?
[ Parent
| on HN ]
Re:Transpiling between any programming languages (2019)
by PaulHoule on Sunday February 16, 2020 @09:57AM
(#22341791)
I think potentially very high.
There's a subset of operators that are similar (but not identical) between programming languages. For instance you can add numbers like
const a = b + c
in javascript int a = b + c
in java, etc, you can even write (b+c) as a
in the select statement of a SQL query. If you look at basic operations on numbers and strings it is not hard to translate expressions between conventional languages and query languages. Now query languages have different ideas about control structures, but working at the expression level you can mostly avoid that.Now there are issues around data types (are we adding ints or floats, what to do about overflow, when you index the Nth element of a string is it 8 bits (maybe part of a Unicode char), is it a basic plane unicode char, or could it be any codepoint, or something else...) but those problems don't turn up 100% of the time when you try to translate.