summaryrefslogtreecommitdiff
path: root/doc/ref/api-peg.texi
diff options
context:
space:
mode:
authorEkaitz Zarraga <ekaitz@elenq.tech>2024-09-11 21:19:26 +0200
committerLudovic Courtès <ludo@gnu.org>2024-12-09 18:13:08 +0100
commitff11753df146d6a170521c898a8c784483c5c743 (patch)
tree76e88bd3531c248ada48a1809d91e1445efa55f3 /doc/ref/api-peg.texi
parent47807c9b118c190fbb6487b2b028170861d7cf5b (diff)
downloadguile-ff11753df146d6a170521c898a8c784483c5c743.tar.gz
PEG: Add full support for PEG + some extensions
This commit adds support for PEG as described in: <https://bford.info/pub/lang/peg.pdf> It adds support for the missing features (comments, underscores in identifiers and escaping) while keeping the extensions (dashes in identifiers, < and <--). The naming system tries to be as close as possible to the one proposed in the paper. * module/ice-9/peg/string-peg.scm: Rewrite PEG parser. * test-suite/tests/peg.test: Fix import Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'doc/ref/api-peg.texi')
-rw-r--r--doc/ref/api-peg.texi8
1 files changed, 6 insertions, 2 deletions
diff --git a/doc/ref/api-peg.texi b/doc/ref/api-peg.texi
index d34ddc64c..84a9e6c6b 100644
--- a/doc/ref/api-peg.texi
+++ b/doc/ref/api-peg.texi
@@ -17,6 +17,10 @@ Wikipedia has a clear and concise introduction to PEGs if you want to
familiarize yourself with the syntax:
@url{http://en.wikipedia.org/wiki/Parsing_expression_grammar}.
+The paper that introduced PEG contains a more detailed description of how PEG
+works, and describes its syntax in detail:
+@url{https://bford.info/pub/lang/peg.pdf}
+
The @code{(ice-9 peg)} module works by compiling PEGs down to lambda
expressions. These can either be stored in variables at compile-time by
the define macros (@code{define-peg-pattern} and
@@ -216,8 +220,8 @@ should propagate up the parse tree. The normal @code{<-} propagates the
matched text up the parse tree, @code{<--} propagates the matched text
up the parse tree tagged with the name of the nonterminal, and @code{<}
discards that matched text and propagates nothing up the parse tree.
-Also, nonterminals may consist of any alphanumeric character or a ``-''
-character (in normal PEGs nonterminals can only be alphabetic).
+Also, nonterminals may include ``-'' character, while in normal PEG it is not
+allowed.
For example, if we:
@lisp