Skip to content

Commit

Permalink
doc/patterns-and-pitfalls.md: fix a typo
Browse files Browse the repository at this point in the history
  • Loading branch information
rrthomas committed Nov 16, 2023
1 parent 39ccead commit 802abda
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion doc/patterns-and-pitfalls.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ Note that the rule for the lower precedence operators (`+` and `-`) invokes the

#### 🐍 Ambiguous recursion

Notice that in the arithmetic grammar above, `mulExp` appears on the right hand side of all of `addExp`'s cases. Be careful that you don't write rules that are "ambiguously recursive", e.g. `addExp = addExp "+" addExp`. If you write your grammar like this, a reader can't tell whether `+` is left-associative or right-associative. (In Ohm, you will actually get a right-assiciative parse — see [#56](https://github.com/ohmjs/ohm/issues/56) for details.)
Notice that in the arithmetic grammar above, `mulExp` appears on the right hand side of all of `addExp`'s cases. Be careful that you don't write rules that are "ambiguously recursive", e.g. `addExp = addExp "+" addExp`. If you write your grammar like this, a reader can't tell whether `+` is left-associative or right-associative. (In Ohm, you will actually get a right-associative parser — see [#56](https://github.com/ohmjs/ohm/issues/56) for details.)

## Semantics

Expand Down

0 comments on commit 802abda

Please sign in to comment.