Filtered by Tag: Engineering

Transpiling between any programming languages (Part 1)

| | Transpilers ANTLR Compass BSON teaching tools aggregation pipelines Compilers Engineering

The Compass team has written a lightweight, extendable transpiler that translates BSON to and from any language. This tool allows developers to work in one language while being able to export the queries and aggregations they build to other languages. Most compilers are one-to-one, or less commonly, one-to-many or many-to-one. There are hardly any many-to-many transpilers. To avoid having to start from scratch, we leveraged the open source parsing tool ANTLR which provided us with a set of compiler tools along with preexisting grammars for the languages we needed. We successfully minimized the amount of additional complexity by coming up with a creative set of class hierarchies that reduced the amount of work needed from n² to n.