diff options
author | Marcin Chrzanowski <marcin.j.chrzanowski@gmail.com> | 2017-08-22 16:23:39 -0400 |
---|---|---|
committer | Marcin Chrzanowski <marcin.j.chrzanowski@gmail.com> | 2017-08-22 16:31:20 -0400 |
commit | 9fcc2b892602f7a964d9c260680b4faab6ee81a4 (patch) | |
tree | d549dae5ca9ea5fbd2f32182c71c7dcb106e1f2d | |
parent | 403f2ed88dbef7ce1bbb07a13bca4bc6e35cbcf3 (diff) |
Update README
-rw-r--r-- | README.md | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -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 ::= <an integer> | '(' 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` |