From 13e482fefb3090645a941a643c73eadcbf0a1a34 Mon Sep 17 00:00:00 2001 From: Marcin Chrzanowski Date: Wed, 30 Aug 2017 18:27:55 -0400 Subject: Implement division --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'README.md') diff --git a/README.md b/README.md index aecf2fe..c140d91 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,7 @@ The parser recognizes the following grammar: | Die ' + ' Die | Die ' - ' Die | Die ' * ' Die + | Die ' / ' Die | Die '+' Die | Die '-' Die | '-' Die @@ -109,6 +110,8 @@ Semantics are defined in terms of the `pool` function. * `D - E` is equivalent to `D + (-E)`. * `D * E` generates a dicepool with a single value - the produc of `roll(D)` and `roll(E)`. +* `D / E` generates a dicepool with a single value - the result of integer + division of `roll(D)` and `roll(E)`. * `D+E` is the additive bonus operation. For each die in `D`'s pool, the die is rolled and `roll(E)` is added to its result. * `D-E` is equivalent to `D+(-E)`. @@ -140,7 +143,10 @@ Semantics are defined in terms of the `pool` function. Additionally: -* The binary arithmetic operations (` + `, ` - `) are left associative. +* The binary arithmetic operations (` + `, ` - `, ` * `, ` / `) are left + associative. +* The binary arithmetic operations bind as expected (multiplication and division + bind stronger than addition and subtraction). * The bonus operations (`+`, `-`) are left associative. They bind stronger than arithmetic operations. * The die operations (`d`, `E`, `K`, etc.) are right associative (`1d2d3` is -- cgit v1.2.3