Logo
1 Logo language
#lang logo | package: logo |
1.1 Program grammar
| ‹program› | ::= | ‹statement›* |
A Logo program is a sequence of statements separated by whitespace. Comments begin with ; and continue until the end of the line.
1.1.1 Statements
| ‹statement› | ::= | ‹procedure-definition› |
|
| | | ‹procedure-call› |
|
| | | if ‹test-expr› ‹block› |
|
| | | repeat ‹count-expr› ‹block› |
| ‹block› | ::= | [ ‹statement›* ] |
1.1.2 Procedures
| ‹procedure-definition› | ::= | to ‹identifier› ‹parameter›* ‹statement›* end |
| ‹procedure-call› | ::= | ‹identifier› ‹arg-expr› |
| ‹parameter› | ::= | an identifier prefixed with : |
1.1.3 Expressions
| ‹expression› | ::= | numeric literal |
|
| | | ‹parameter› |
|
| | | ‹expression› ‹operator› ‹expression› |
| ‹operator› | ::= | + | - | * | / | = | < | > |
2 Built-in procedures
2.1 Turtle graphics
syntax
(left φ)
syntax
(right φ)
syntax
(home)
syntax
syntax
(cs)
3 Examples
The file sierpinski.rkt in this package shows how to draw a Sierpinski triangle using turtle graphics.