Page 1 of 1

Old Project of mine - High Level to High Level

Posted: Fri Jun 24, 2016 9:45 am UTC
by LjSpike
I'm thinking with the long break i'm going to get, to have another go at an old project of mine, which I didn't get to far into last time round.
Its a python program, to take a document in a programming language, and make a new document doing the same, but in a different language, preferably for changes between as many languages as possible.

If anyone wants to lend a hand, I'd appreciate it, compilers aren't the easiest things to make, and this probably won't be either.

Re: Old Project of mine - High Level to High Level

Posted: Wed Oct 26, 2016 7:07 pm UTC
by TvT Rivals
This is really ambitious, maybe too much... even with a restriction that you are not allowed to use packages and such. Some languages have thousands of packages after all, and they're definitely not organized in the same way.

Re: Old Project of mine - High Level to High Level

Posted: Wed Dec 07, 2016 4:26 pm UTC
by roflwaffle
I'd love it if you or someone else were just able to create something that would parse and evaluate help files/etc in different languages to create an index of functionality. The hardest part would be putting it all together with unique descriptions for similar behavior across different languages.

Re: Old Project of mine - High Level to High Level

Posted: Wed Dec 07, 2016 11:52 pm UTC
by Jplus
What you describe is a compiler. Of the hardest kind: compiling many languages to many languages, not just removing abstractions but also adding new ones in the process. I'm not sure, but I think the part about adding new abstractions might be an unsolved problem.

They did something similar for text documents with Pandoc. Maybe that can inspire you.

Pandoc uses an internal intermediate format that input formats are converted to and output formats are converted from. You should probably do the same in your ambitious project.

LLVM offers an intermediate representation for programming languages. You can create frontends that convert from a high level programming language to LLVM. Independently, you can create backends that convert from LLVM to a machine language. There exist LLVM compilers for many high level programming languages. So by using LLVM, you can reduce your problem to "just" compiling back from LLVM to the high level languages that you want to output to. Which is almost certainly the hardest part, but the other parts are hard too, and a lot of work.