blob: 42507dd6e19c9abf9f416307eb787e2d1f75db21 (
plain)
1
2
3
4
5
6
7
8
9
10
|
# randomart.bnf -- syntax with semantics for generating random art -*- BNF -*-
<expr> ::= <value> | 0 "-" <expr> | 10 <binop> | 3 <trig> | 1 "abs(" <expr> ")" | 5 "sqrt(abs(" <expr> "))"
<value> ::= 3 <coord> | <mouse> | <time> | <const>
<coord> ::= 4 "c.x" | 3 "c.y"
<mouse> ::= 4 "m.x" | 3 "m.y"
<time> ::= "sin(t)" | "cos(t)"
<const> ::= "." <digit> <digit> <digit> <digit> <digit> <digit>
<digit> ::= 10 "0" | 9 "1" | 8 "2" | 7 "3" | 6 "4" | 5 "5" | 4 "6" | 3 "7" | 2 "8" | 1 "9"
<binop> ::= 1 "(" <expr> " + " <expr> ")" | 30 "(" <expr> " - " <expr> ")" | 5 <expr> "*" <expr> | 7 "(" <expr> "/" <expr> ")"
<trig> ::= "sin(" <expr> ")" | "cos(" <expr> ")" | 0 "tan(" <expr> ")"
|