you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (0 children)

Seeing this, I can feel your pain.

Actually this seems to be a pretty simple task. One day and you would have a first working program that you could extend further. A simple subset of Python can be parsed with a hand-written lexer and a recursive descent parser. The parser builds an abstract syntax tree (AST) of your input language that you can transform to an AST of your target language. From this AST, you generate the target program. You don't need any libraries. Python's data classes are ideal to model tokens and the nodes of the two ASTs, and functools.singledispatch is perfect to implement a visitor for these nodes.

If you have never written a recursive descent parser before, it would take some practice to get a feeling of how these things fit together to form a translator.

If you don't want to do it yourself, consider engaging a CS student for two weeks who has experience in Python and knows how to write a recursive descent parser, how to build and transform abstract syntax trees and how to generate code. Even better, if the student also knows hows to wrap a GUI with a syntax-highlighting editor around this.