I remember we did something similar for one of the #ICFPC contests! It actually was a way smoother experience than I have expected.
https://github.com/Vlad-Shcherbina/icfpc2014-tbd/blob/master/production/gcc_ast_converter.py
@jb55 haha, sorry for confusion, "GHC" and "GCC" come from the problem statement. One is an assembly for programming ghost AIs and the other is a lsip virtual machine for programming Pacman AI.
@jb55 but AST module is absolutely built-in: https://docs.python.org/3/library/ast.html
@jb55 oh, nvm, I saw your code, you use it :)
@jonn whoa what is this gcc ast thing 👀
how would type inference work here 🤔
here's my code, pretty dumb so far: https://jb55.com/s/567a44110d947423.txt