Search code examples
language-agnostictranslationpseudocodetranspiler

runnable pseudocode?


I am attempting to determine prior art for the following idea:

1) user types in some code in a language called (insert_name_here);

2) user chooses a destination language from a list of well-known output candidates (javascript, ruby, perl, python);

3) the processor translates insert_name_here into runnable code in destination language;

4) the processor then runs the code using the relevant system call based on the chosen language

The reason this works is because there is a pre-established 1 to 1 mapping between all language constructs from insert_name_here to all supported destination languages.

(Disclaimer: This obviously does not produce "elegant" code that is well-tailored to the destination language. It simply does a rudimentary translation that is runnable. The purpose is to allow developers to get a quick-and-dirty implementation of algorithms in several different languages for those cases where they do not feel like re-inventing the wheel, but are required for whatever reason to work with a specific language on a specific project.)

Does this already exist?


Solution

  • There are converters available for different languages. The problem you are going to have is dealing with libraries. While mapping between language statements might be easy, finding mappings between library functions will be very difficult.

    I'm not really sure how useful that type of code generator would be. Why would you want to write something in one language and then immediately convert it to something else? I can see the rationale for 4th Gen languages that convert diagrams or models into code but I don't really see the point of your effort.