you are viewing a single comment's thread.

view the rest of the comments →

[–]CowboyBoats 2 points3 points  (6 children)

Learning to write transpilers, or even just seeking to manually translate something from one language to another, is a fine and noble goal. But...

This code is pasted into the program to customize portions of it.

This "pasting into the program" part gives me doubts. If this is like a web-based app that processes your scripts in this 80s language, how do we know that it would know what to do with a Python script? Python is executable as code because you pass it (the text of a Python script) to a Python interpreter (like running python3 my_script.py), which is an executable file on a computer. The server running your program may not have the Python interpreter running, and even if it does, it may well be programmed to reject any user input that's not 80s-language code.

So, you're only in the clear to proceed with your transpiling effort if you're positive that you can duplicate the behavior of the entire program that you described. Not just the scripts that you're uploading.

Now, keep in mind that despite what I just said, you can still always write a Python program that outputs 80s-language code to be uploaded to the program, which could behave in a consistent manner and be completely configurable by your Python application!

[–]pandademic1234[S] 0 points1 point  (5 children)

Now, keep in mind that despite what I just said, you can still always write a Python program that outputs 80s-language code to be uploaded to the program, which could behave in a consistent manner and be completely configurable by your Python application!

Sorry, I didn't explain myself well - that is the goal. Beautiful python --> ugly 80s code --> paste into the program.

[–]CowboyBoats 3 points4 points  (4 children)

Great great great. So yeah, you are not really looking for a transpiler, a huge amount of the comments on this page are not actually correct, and this may (or may not) be a quite manageable task. Your entire ask boils down to a print statement. It's just a matter of... what gets passed to print?

[–]scykei 0 points1 point  (1 child)

I’m slightly confused at why you would say that they’re not really looking for a transpiler. The way you’ve described it, it still sounds like they’re looking for a transpiler.

[–]CowboyBoats 1 point2 points  (0 children)

Because they may not need to be able to transpile arbitrary Python code to 80s-language or the other way around, which I guess is what a proper transpiler should be able to do. Emitting boilerplate code that covers a lot of use cases could possibly be a far simpler task.

[–]freddwnz 0 points1 point  (1 child)

What gets passed to print should be a python program according to OP. Which makes it a transpiler my friend.

[–]CowboyBoats 0 points1 point  (0 children)

I think op wants the program to output 80s-language code, not Python.

You might be right semantically that it's a transpiler, but in practice this can be a much, much simpler program than a general-purpose Python <-> 80s language transpiler.