LOGO inspired graphics lang

Intro

Idea is to have a very simple language which is able to create line graphics.

Language

Movement

Mx = (m)ove by distance x
Tx = (t)urn by x degrees (values < 180 is left turn)

Pen state

Px = set (p)en color to x
Fx = set (f)ill color to x
Wx = set pen (w)idth to x
Sx = (s)cale by x percent

Draw

Lx = draw line by distance x
Cx = draw circle with radius x

Flow control

Nx() = repeat expression
Gx() = define group identified by x 
Gx   = call group identified by x
H    = halt execution here
R    = return to origo at 0 angle and reset pen state

Comments

#   = comment line
#() = inline comment

Example

Flower

N8(L50 T40 L50 T140 L50 T40 L50 T185)

Program format

Commands is formatted as one of 3 classes

Single letter like:

H
R

Single letter plus one integer argument like

M123
T45

Single letter plus one integer argument plus one expression argument like

N4(L10T90)

Commands are entered in a sequence with optional space and/or comments between them.

This example

N8(
  # flower leaf
  L50T20
  L50T140
  L50T20
  L50
  # set new direction to 45
  T185
)

is equivalent with this

N8(L50 T40 L50 T140 L50 T40 L50 T185)

which looks like this:

wishline flower

Editor

References