PEG Renames
authorNoah Lavine <noah.b.lavine@gmail.com>
Sun, 22 Jan 2012 19:58:35 +0000 (14:58 -0500)
committerAndy Wingo <wingo@pobox.com>
Wed, 16 Jan 2013 09:11:49 +0000 (10:11 +0100)
* module/ice-9/peg.scm: rename 'define-grammar' to
 'define-peg-string-patterns'
* module/ice-9/peg/string-peg.scm: same
* doc/ref/api-peg.texi: same
* test-suite/tests/peg.bench: same
* test-suite/tests/peg.test: same

doc/ref/api-peg.texi
module/ice-9/peg.scm
module/ice-9/peg/string-peg.scm
test-suite/tests/peg.bench
test-suite/tests/peg.test

index 58c2762..fa1e29e 100644 (file)
@@ -19,7 +19,7 @@ familiarize yourself with the syntax:
 
 The 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 @code{define-grammar}) or calculated
+(@code{define-peg-pattern} and @code{define-peg-string-patterns}) or calculated
 explicitly at runtime with the compile functions
 (@code{peg-sexp-compile} and @code{peg-string-compile}).
 
@@ -206,11 +206,11 @@ retrieved from this record with the PEG match deconstructor functions.
 More complicated (and perhaps enlightening) examples can be found in the
 tutorial.
 
-@deffn {Scheme Macro} define-grammar peg-string
+@deffn {Scheme Macro} define-peg-string-patterns peg-string
 Defines all the nonterminals in the PEG @var{peg-string}.  More
-precisely, @code{define-grammar} takes a superset of PEGs.  A normal PEG
+precisely, @code{define-peg-string-patterns} takes a superset of PEGs.  A normal PEG
 has a @code{<-} between the nonterminal and the pattern.
-@code{define-grammar} uses this symbol to determine what information it
+@code{define-peg-string-patterns} uses this symbol to determine what information it
 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{<}
@@ -220,11 +220,11 @@ character (in normal PEGs nonterminals can only be alphabetic).
 
 For example, if we:
 @lisp
-(define-grammar 
+(define-peg-string-patterns 
   "as <- 'a'+
 bs <- 'b'+
 as-or-bs <- as/bs")
-(define-grammar 
+(define-peg-string-patterns 
   "as-tag <-- 'a'+
 bs-tag <-- 'b'+
 as-or-bs-tag <-- as-tag/bs-tag")
@@ -513,7 +513,7 @@ As a first pass at this, we might want to have all the entries in
 
 Doing this with string-based PEG syntax would look like this:
 @lisp
-(define-grammar
+(define-peg-string-patterns
   "passwd <- entry* !.
 entry <-- (! NL .)* NL*
 NL < '\n'")
@@ -644,7 +644,7 @@ Let's extend this example a bit more and actually pull some useful
 information out of the passwd file:
 
 @lisp
-(define-grammar
+(define-peg-string-patterns
   "passwd <-- entry* !.
 entry <-- login C pass C uid C gid C nameORcomment C homedir C shell NL*
 login <-- text
@@ -732,7 +732,7 @@ continue because it didn't have to match the nameORcomment to continue.
 We can parse simple mathematical expressions with the following PEG:
 
 @lisp
-(define-grammar
+(define-peg-string-patterns
   "expr <- sum
 sum <-- (product ('+' / '-') sum) / product
 product <-- (value ('*' / '/') product) / value
@@ -822,7 +822,7 @@ a good choice:
 @lisp
 (use-modules (srfi srfi-1))
 
-(define-grammar
+(define-peg-string-patterns
   "expr <- sum
 sum <-- (product ('+' / '-'))* product
 product <-- (value ('*' / '/'))* value
@@ -881,7 +881,7 @@ For a more tantalizing example, consider the following grammar that
 parses (highly) simplified C functions:
 
 @lisp
-(define-grammar
+(define-peg-string-patterns
   "cfunc <-- cSP ctype cSP cname cSP cargs cLB cSP cbody cRB
 ctype <-- cidentifier
 cname <-- cidentifier
index ea0f519..e5798dd 100644 (file)
   #:use-module (ice-9 peg using-parsers)
   #:use-module (ice-9 peg cache)
   #:re-export (define-peg-pattern
+               define-peg-string-patterns
                match-pattern
                search-for-pattern
                peg-sexp-compile
-               define-grammar
                define-grammar-f
                keyword-flatten
                context-flatten
index 7028e79..7859f6f 100644 (file)
@@ -19,7 +19,7 @@
 
 (define-module (ice-9 peg string-peg)
   #:export (peg-as-peg
-            define-grammar
+            define-peg-string-patterns
             define-grammar-f
             peg-grammar)
   #:use-module (ice-9 peg using-parsers)
@@ -118,7 +118,7 @@ RB < ']'
 
 ;; Macro wrapper for PEG-PARSER.  Parses PEG grammars expressed as strings and
 ;; defines all the appropriate nonterminals.
-(define-syntax define-grammar
+(define-syntax define-peg-string-patterns
   (lambda (x)
     (syntax-case x ()
       ((_ str)
index 108efe6..7baad5c 100644 (file)
@@ -63,7 +63,7 @@
 (define (eq-parse str) (apply parse-expr (peg:tree (match-pattern expr str))))
 
 ;; PEG for parsing equations (see tutorial).
-(define-grammar
+(define-peg-string-patterns
   "expr <- sum
 sum <-- (product ('+' / '-'))* product
 product <-- (value ('*' / '/'))* value
index 09d1f4e..f516571 100644 (file)
@@ -62,7 +62,7 @@
 (with-test-prefix "PEG Grammar"
   (pass-if
    "defining PEGs with PEG"
-   (and (eeval `(define-grammar ,(@@ (ice-9 peg) peg-as-peg))) #t))
+   (and (eeval `(define-peg-string-patterns ,(@@ (ice-9 peg) peg-as-peg))) #t))
   (pass-if
    "equivalence of definitions"
    (equal?
@@ -90,7 +90,7 @@ messagebus:x:103:107::/var/run/dbus:/bin/false
 ")
 
 ;; A grammar for parsing /etc/passwd files.
-(define-grammar
+(define-peg-string-patterns
   "passwd <-- entry* !.
 entry <-- login CO pass CO uid CO gid CO nameORcomment CO homedir CO shell NL*
 login <-- text
@@ -109,7 +109,7 @@ SLASH < '/'")
 
 ;; Tests some actual parsing using PEGs.
 (with-test-prefix "Parsing"
-  (eeval `(define-grammar ,comment-grammar))             
+  (eeval `(define-peg-string-patterns ,comment-grammar))                 
   (pass-if
    ;; Pascal-style comment parsing
    "simple comment"
@@ -164,7 +164,7 @@ SLASH < '/'")
       (record? #t)))))
 
 ;; PEG for parsing right-associative equations.
-(define-grammar
+(define-peg-string-patterns
   "expr <- sum
 sum <-- (product ('+' / '-') sum) / product
 product <-- (value ('*' / '/') product) / value
@@ -217,7 +217,7 @@ number <-- [0-9]+")
           '(+ 1 (+ (/ 1 (* 2 3)) (/ (+ 1 1) 2))))))
 
 ;; PEG for parsing left-associative equations (normal ones).
-(define-grammar
+(define-peg-string-patterns
   "expr <- sum
 sum <-- (product ('+' / '-'))* product
 product <-- (value ('*' / '/'))* value