Comment

Comment by cosmic_quanta

I've been thinking of a pandoc-like tool to translate between languages, i.e. a transpiler.

You would need to write down the most general abstract syntax tree (AST) that encompasses all supported languages' features, as well as a way to read languages into this AST, and write the AST into languages.

The cool thing about pandoc is the ability to transform the AST between the read and write. In the context of a transpiler, that might mean that you transform the AST to be safer (e.g. adding type-checks in Python) before writing out.

That would be a very tedious tool to write, given that every language has its strange behaviors. But it might be a fun project if you limit the number of languages you support.

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton