From 9fcc2b892602f7a964d9c260680b4faab6ee81a4 Mon Sep 17 00:00:00 2001 From: Marcin Chrzanowski Date: Tue, 22 Aug 2017 16:23:39 -0400 Subject: Update README --- README.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 16ec451..8c273ec 100644 --- a/README.md +++ b/README.md @@ -70,15 +70,15 @@ games are supported. You can do things like: **Note:** this is still an early version. Syntax and semantics will be expanded in future versions. *Backwards incompatible changes are possible.* -The parser recognizes the following grammar (all whitespace between symbols is -ignored): +The parser recognizes the following grammar: Die ::= | '(' Die ')' | Die 'd' Die | 'd' Die + | Die ' + ' Die + | Die ' - ' Die | Die '+' Die - | Die '-' Die | '-' Die | Die 'E' Die | Die 'K' Die @@ -93,10 +93,12 @@ Semantics are defined in terms of the `pool` function. numbers, each between 1 and `roll(E)`. *Note:* if `D` or `E` evaluates to a negative number, the behavior is undefined. * `dD` is equivalent to `1dD`. -* `D+E` appends the dice pool generated by `E` to the dice pool generated by +* `D + E` appends the dice pool generated by `E` to the dice pool generated by `D`. * `-D` returns the opposites of values generated by `D`. -* `D-E` is equivalent to `D+(-E)`. +* `D - E` is equivalent to `D + (-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. * `DEF` (here `E` is the literal symbol `E`, `D` and `F` are dice expressions) is an "exploding die." First `D` is rolled. Now each die in the dice pool generated by `F` is rolled repeatedly until it rolls something less than the @@ -110,7 +112,7 @@ 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 die operations (`d`, `E`, `K`) are right associative (`1d2d3` is equivalent to `1d(2d3)`, use explicit parentheses if you need `(1d2)d3`). * Die operations bind stronger than the binary arithmetic operations (`1d6+1d4` -- cgit v1.2.3