I'm currently working on mapping IR to Python AST....
# python
p
I'm currently working on mapping IR to Python AST. This file in the newest version gives a good grasp of the progress: https://github.com/krzema12/kotlin-1/blob/python-backend/python/experiments/out-ir.py. You can see some missing parts as e. g.
visitExpression
. This file's 99.9% is the standard lib (JS flavor), and you can see that the first function
fold
is generated almost entirely :) I work now by looking for places that are missing (
visit...
) and adding a needed mapping. Quite slow, but surprisingly entertaining process to see the Python code appear bit by bit :)
đŸ”„ 1
c
I see! I've got a project at uni rn where we do something similar with Bison/Flex, I guess the hard part is building the AST, translating it to Python might not be that hard đŸ€”
p
Yes, exactly - AST to Python is pretty simple