aboutsummaryrefslogtreecommitdiff
path: root/src/randomart-2.bnf
diff options
context:
space:
mode:
authorLibravatar Martin Michalec <martin@michalec.dev>2026-11-08 08:19:44 +0000
committerLibravatar Martin Michalec <martin@michalec.dev>2026-11-08 08:23:19 +0000
commit5be0e39d0ce97849d7722bd1ac98563c7014faf3 (patch)
tree9dba821664337a6662a6da88dfe86291d269c36b /src/randomart-2.bnf
downloadlab-05-master.tar.gz
publishHEADmaster
Diffstat (limited to 'src/randomart-2.bnf')
-rw-r--r--src/randomart-2.bnf10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/randomart-2.bnf b/src/randomart-2.bnf
new file mode 100644
index 0000000..42507dd
--- /dev/null
+++ b/src/randomart-2.bnf
@@ -0,0 +1,10 @@
1# randomart.bnf -- syntax with semantics for generating random art -*- BNF -*-
2 <expr> ::= <value> | 0 "-" <expr> | 10 <binop> | 3 <trig> | 1 "abs(" <expr> ")" | 5 "sqrt(abs(" <expr> "))"
3<value> ::= 3 <coord> | <mouse> | <time> | <const>
4<coord> ::= 4 "c.x" | 3 "c.y"
5<mouse> ::= 4 "m.x" | 3 "m.y"
6 <time> ::= "sin(t)" | "cos(t)"
7<const> ::= "." <digit> <digit> <digit> <digit> <digit> <digit>
8<digit> ::= 10 "0" | 9 "1" | 8 "2" | 7 "3" | 6 "4" | 5 "5" | 4 "6" | 3 "7" | 2 "8" | 1 "9"
9<binop> ::= 1 "(" <expr> " + " <expr> ")" | 30 "(" <expr> " - " <expr> ")" | 5 <expr> "*" <expr> | 7 "(" <expr> "/" <expr> ")"
10 <trig> ::= "sin(" <expr> ")" | "cos(" <expr> ")" | 0 "tan(" <expr> ")"