From 846736b8823e66b8d05faffa77d6a37c3551407a Mon Sep 17 00:00:00 2001 From: yhirose Date: Sat, 8 Feb 2020 19:28:39 -0500 Subject: [PATCH] Updated README --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index eac7bf6..883b9fe 100644 --- a/README.md +++ b/README.md @@ -21,11 +21,10 @@ The PEG syntax is well described on page 2 in the [document](http://www.brynosau * `$name<` ... `>` (Named capture operator) * `$name` (Backreference operator) * `MACRO_NAME(` ... `)` (Parameterized rule or Macro) + * `{ precedence L - + L / * }` (Parsing infix expression) This library supports the linear-time parsing known as the [*Packrat*](http://pdos.csail.mit.edu/~baford/packrat/thesis/thesis.pdf) parsing. -*Parsing infix expression by [Precedence climbing](https://eli.thegreenplace.net/2012/08/02/parsing-expressions-by-precedence-climbing)* algorithm is also supported. - IMPORTANT NOTE for some Linux distributions such as Ubuntu and CentOS: Need `-pthread` option when linking. See [#23](https://github.com/yhirose/cpp-peglib/issues/23#issuecomment-261126127), [#46](https://github.com/yhirose/cpp-peglib/issues/46#issuecomment-417870473) and [#62](https://github.com/yhirose/cpp-peglib/issues/62#issuecomment-492032680). How to use @@ -346,6 +345,8 @@ T(x) ← < x > _ Parsing infix expression by Precedence climbing ----------------------------------------------- +Regarding the *precedence climbing algorithm*, please see [this article](https://eli.thegreenplace.net/2012/08/02/parsing-expressions-by-precedence-climbing). + ```cpp parser parser(R"( EXPRESSION <- INFIX_EXPRESSION(ATOM, OPERATOR) @@ -354,6 +355,7 @@ parser parser(R"( NUMBER <- < '-'? [0-9]+ > %whitespace <- [ \t]* + # Declare order of precedence INFIX_EXPRESSION(A, O) <- A (O A)* { precedence L + -