Write a custom compiler. I wrote one last simestor for a class. You have to understand tree structures. Antlr is pretty easy to learn. I should post an example here. In antler class I built a simple command line structure that exports code for agk. I do not know if they use a similar program like antler.
write your own compiler and at each leaf node in the compiler add opengl code to do something similar to agk.
Developer of Space Chips, pianobasic, zipzapzoom, and vet pinball apps. Developed the tiled map engine seen on the showcase. Veteran for the military.