summaryrefslogtreecommitdiff
path: root/dice-lang/lang-desc.md
diff options
context:
space:
mode:
authorbculkin2442 <bjculkin@mix.wvu.edu>2016-07-27 22:45:03 -0400
committerbculkin2442 <bjculkin@mix.wvu.edu>2016-07-27 22:45:03 -0400
commitf62abec2577d3745475581a19eff71dbb8c0494e (patch)
tree2793192a9d393302b56783399dbc58fe5e220d4e /dice-lang/lang-desc.md
parent67fee39e6dd22fce8dfaa800f0a5ddbe0ede0be3 (diff)
Some minor cleanliness, and beginning work on a language description.
Diffstat (limited to 'dice-lang/lang-desc.md')
-rw-r--r--dice-lang/lang-desc.md59
1 files changed, 59 insertions, 0 deletions
diff --git a/dice-lang/lang-desc.md b/dice-lang/lang-desc.md
new file mode 100644
index 0000000..1d3fdd1
--- /dev/null
+++ b/dice-lang/lang-desc.md
@@ -0,0 +1,59 @@
+# Dice-Lang Language Description
+Dice lang was originally just a program for rolling
+patterns of dice. However, through some effort
+and pushing a shunting-yard parser farther than
+it probably should have gone, it became a language.
+It's still missing some things, but its getting there
+
+## Basic Syntax
+You can use it like a 4-function calculator.
+```
+1+1
+-> 2
+1+1
+2+2*2+2
+-> 8
+```
+However, we don't support floating point numbers or math
+```
+1.1
+-> ERROR: Floating point literals are not supported
+10/3
+-> 3
+```
+We do, however, support dice literals
+```
+1d6
+-> 6
+1d6
+-> 3
+```
+These can be treated as numbers, but won't get turned into
+numbers until you actually ask them to turn into numbers.
+
+## Variables and Assignment
+There are variables, and you can assign things to them
+```
+test := 1
+-> 1
+```
+When you assign a variable, its current value is mentioned.
+To make sure that dice behave correctly, you can bind
+them to a variable
+```
+die := 1d6
+-> 5
+die
+-> 3
+```
+There exists a meta-variable 'last' whose value is always the
+result of the last expression.
+```
+test := 1d6*2d8
+-> 9
+last
+-> 30
+```
+We also have let, for binding things in the context of an
+expression. However, let isn't quite working at the moment
+## Arrays