Old Project of mine - High Level to High Level

A place to discuss the science of computers and programs, from algorithms to computability.

Formal proofs preferred.

Moderators: phlip, Moderators General, Prelates

Posts: 26
Joined: Fri Jun 17, 2016 8:14 pm UTC

Old Project of mine - High Level to High Level

Postby LjSpike » Fri Jun 24, 2016 9:45 am UTC

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.

User avatar
TvT Rivals
Posts: 41
Joined: Wed Oct 26, 2016 2:27 am UTC

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

Postby TvT Rivals » Wed Oct 26, 2016 7:07 pm UTC

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.

User avatar
Posts: 360
Joined: Wed Jul 01, 2009 6:25 am UTC

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

Postby roflwaffle » Wed Dec 07, 2016 4:26 pm UTC

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.

User avatar
Posts: 1721
Joined: Wed Apr 21, 2010 12:29 pm UTC
Location: Netherlands

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

Postby Jplus » Wed Dec 07, 2016 11:52 pm UTC

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.
"There are only two hard problems in computer science: cache coherence, naming things, and off-by-one errors." (Phil Karlton and Leon Bambrick)

coding and xkcd combined


Return to “Computer Science”

Who is online

Users browsing this forum: No registered users and 5 guests