Logo Applet
Use
The syntax of this language is pretty simple, it consists of
a string of tokens, both commands and arguments, seperated
by whitespace. Multiple ommands are executed from right to left.
Each command is followed by zero or more arguments determined by
the command (java bytecode style). Block structures are created
with square brackets, "[" and "]". Everything within these brackets
is treated as one command.
Arguments may be decimal numbers, variables, or arithmatic expressions
using the four basic opperations, powers (a^b = ab)
and modulo (a%b = a modulo b). Orders of operation are supported but not
parentheses, and no spaces. All arguments are given in pixels for
distance and degrees for angles.
There are 8 primative commands which are used as follows.
penup
pendown
forward distance
back distance
left angle
right angle
clear
reset
User-defined commands can also be defined in the large text box.
The format is as follows:
on commandName [arg1 [arg2 [...]]]
statement1
statement2
...
statementn
end
The difference between newlines and spaces is immaterial.
Statements are commands and/or control structures. The control
structors are as follows:
if expression1 compareType expression2 statement
(CompareType is equals, greater than, less than, etc.
Performs statement if the comparison is true)
repeat expression statement
make varName expression
(Declare a variable and initalize it with a value.
Also used to put a new value into a variable.)
stop (returns from a command invocation)
The source:
LogoApplet.java
LogoCanvas.java
And, optionally,
LogoCanvasWithCNC.java
which outputs standard CNC code to System.out.