I work a lot with Aerotech's Aerobasic which is G code mixed with a basic like language. You can generate G code on the fly and execute it, manipulate files, call other programs, text boxes, menu boxes, etc.
I wrote a simple teach mode program that puts the machine into jog mode where you move the axes around and create points and associate a command for each, e.g. G0 rapid, G1 coordinated, G2 clockwise arc, G3 counterclockwise arc. Each move is then written to a file that is saved and loaded afterward for testing. Nice system but very costly.