I have started writing a little collection of functions in JavaScript that will generate g-code for me.

The idea is that I wanted an easy way to script gcode. For example if I want to drill a circle centered at X=0,Y=0,Z=0 and a radius of 1″, I wanted to be able to write drawCircle(x,y,z,radius); instead of the very unwieldy g-code:
(circle x=0 y=0 z=0 radius=1)
G0 X-1.000000 Y0.000000 (rapid to start)
G1 Z0.000000
G17 G2 X-1.000000 Y0.000000 I1.000000 J0.000000 Z0.000000
G0 Z0.500000 (safe z)
(end of circle)

Source code:

http://www.unfocusedbrain.com/projects/2009/js-g-code/jstogcode.html

This version supports: Lines, Boxes, Circles, Arcs, and deep circles.