BNF
Scato gramma breaf memo
Scato gramma breaf memo¶Gramma¶Program is a sequence of wards (tokens). Words separate by spaces; spaces, tabulations and new-line-characters are all equal, and mean just space. The first `#' in line and the rest of the line are ignored. It is comments. Expressions (statements) are composed of tokens. Statements¶Groups¶If you need to compose number of statements, you may user begin/end-block. It is one statement: begin ...STATEMENTS... end Drawing and moving¶draw VAR-OR-VAL VAR-OR-VAL jump VAR-OR-VAL VAR-OR-VAL scale VAR-OR-VAL right VAR-OR-VAL left VAR-OR-VAL width VAR-OR-VAL Affine transformations¶affinescale VAR-OR-VAL VAR-OR-VAL # Scale X and Y axis affinerotate VAR-OR-VAL VAR-OR-VAL # Roatte X and Y axis affinematrix VAR-OR-VAL VAR-OR-VAL VAR-OR-VAL VAR-OR-VAL # Specify matrix Colors¶color VAR-OR-VAL VAR-OR-VAL VAR-OR-VAL # red, green, blue bgcolor VAR-OR-VAL VAR-OR-VAL VAR-OR-VAL # red, green, blue mixcolor VAR-OR-VAL VAR-OR-VAL VAR-OR-VAL VAR-OR-VAL # red, green, blue, factor Variables and calculations¶Assignments: set VAR VAR-OR-VAL # VAR := VAR-OR-VAL sin VAR VAR-OR-VAL # VAR := sin(VAR-OR-VAL) cos VAR VAR-OR-VAL # VAR := cos(VAR-OR-VAL) exp VAR VAR-OR-VAL # VAR := exp(VAR-OR-VAL) log VAR VAR-OR-VAL # VAR := log(VAR-OR-VAL) sqrt VAR VAR-OR-VAL # VAR := sqrt(VAR-OR-VAL) Calculations: add VAR VAR-OR-VAL # VAR := VAR + VAR-OR-VAL sub VAR VAR-OR-VAL # VAR := VAR - VAR-OR-VAL mul VAR VAR-OR-VAL # VAR := VAR * VAR-OR-VAL div VAR VAR-OR-VAL # VAR := VAR / VAR-OR-VAL mod VAR VAR-OR-VAL # VAR := VAR % VAR-OR-VAL pow VAR VAR-OR-VAL # VAR := VAR ** VAR-OR-VAL Changes: incr VAR # VAR := VAR + 1 decr VAR # VAR := VAR - 1 neg VAR # VAR := - VAR abs VAR # VAR := | VAR | Conditions¶if CONDITION then STATEMENT if CONDITION then STATEMENT else STATEMENT where CONDITION is a triplet: VAR-OR-VAL OPERATION VAR-OR-VAL and OPERATION is one of lt, gt, le, ge, eq or ne. Loops¶iterate VAR-OR-VAL STATEMENT repeat STATEMENT until CONDITION while CONDITION STATEMENT Context¶local STATEMENT # localize all aspects of context save STATEMENT # localize variables values only transform STATEMENT # localize tortoise state only Procedures¶procedure NAME STATEMENT # declare procedure call NAME # call procedure by name Other¶nop # do nothing |
► Sign in to add a comment