[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] GNU Guile branch, wip-peg-fixed, updated. v2.0.2-127-g26

From: Noah Lavine
Subject: [Guile-commits] GNU Guile branch, wip-peg-fixed, updated. v2.0.2-127-g265ac56
Date: Wed, 21 Sep 2011 20:37:43 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".

The branch, wip-peg-fixed has been updated
       via  265ac5640a79d5536b9664f70a921fadbed093ad (commit)
      from  c9502660c5259a06ccc16fb882f2ac71ce101bfa (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 265ac5640a79d5536b9664f70a921fadbed093ad
Author: Noah Lavine <address@hidden>
Date:   Wed Sep 21 15:46:44 2011 -0400

    Document PEGs at Runtime
    doc/ref/api-peg.texi: suggest a cleaner method of generating PEG parsers
      at runtime.


Summary of changes:
 doc/ref/api-peg.texi |   26 +++++++++++++++-----------
 1 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/doc/ref/api-peg.texi b/doc/ref/api-peg.texi
index a489268..8944441 100644
--- a/doc/ref/api-peg.texi
+++ b/doc/ref/api-peg.texi
@@ -281,17 +281,6 @@ Note that in doing this, we have bound 6 variables at the 
 @end deffn
-These are macros, with all that entails.  If you've built up a list at
-runtime and want to define a new PEG from it, you should e.g.:
-(define exp '(+ "a"))
-(eval `(define-nonterm as body ,exp) (interaction-environment))
address@hidden lisp
-The @code{eval} function has a bad reputation with regard to efficiency,
-but this is mostly because of the extra work that has to be done
-compiling the expressions, which has to be done anyway when compiling
-the PEGs at runtime.
 @subsubheading Compile Functions
 It is sometimes useful to be able to compile anonymous PEG patterns at
 runtime.  These functions let you do that using either syntax.
@@ -309,6 +298,21 @@ Compiles the PEG pattern in @var{peg-sexp} propagating 
according to
 @end deffn
+The functions return syntax objects, which can be useful if you want to
+use them in macros. If all you want is to define a new nonterminal, you
+can do the following:
+(define exp '(+ "a"))
+(define as (compile (peg-sexp-compile exp 'body)))
address@hidden lisp
+You can use this nonterminal with all of the regular PEG functions:
+(peg-parse as "aaaaa") @result{}
+#<peg start: 0 end: 5 string: bbbbb tree: bbbbb>
address@hidden lisp
 @subsubheading Parsing & Matching Functions

GNU Guile

reply via email to

[Prev in Thread] Current Thread [Next in Thread]