Noah Lavine
680f1dee0c
Comments in PEG
...
module/ice-9/peg/string-peg.scm: add comments explaining the format of some
of the parsed PEG forms.
2013-01-16 10:11:47 +01:00
Noah Lavine
cdeb5a7826
Remove 'body' PEG
...
module/ice-9/peg/string-peg.scm: update S-expression generators to use the
new *, +, ?, followed-by, and not-followed-by forms.
module/ice-9/peg/codegen.scm: remove the 'body' form in the PEG s-expression
representation.
2013-01-16 10:11:47 +01:00
Noah Lavine
72287411e9
Add 'not-followed-by' PEG
...
The PEG s-expression syntax now uses '(not-followed-by ...)' instead of
'(body ! ... 1)'.
2013-01-16 10:11:46 +01:00
Noah Lavine
66ba3de0a6
Add 'followed-by' PEG
...
The PEG s-expression syntax now uses '(followed-by ...)' instead of
'(body & ... 1)'.
2013-01-16 10:11:46 +01:00
Noah Lavine
8e97edd5d3
Add '?' PEG
...
The PEG s-expression syntax now uses '(? ...)' instead of '(body lit ... ?)'.
2013-01-16 10:11:46 +01:00
Noah Lavine
3d19969d74
Add '+' PEG
...
The PEG s-expression syntax now uses '(+ ...)' instead of '(body lit ... +)'.
2013-01-16 10:11:46 +01:00
Noah Lavine
f310a111de
Add '*' PEG
...
The s-expression representation of PEG grammars now uses a '(* ...)' form
instead of '(body lit ... *)'.
2013-01-16 10:11:46 +01:00
Noah Lavine
5c3f2da81f
Clean Up PEG Codegen
...
* module/ice-9/peg/codegen.scm: remove unnecessary literals in
peg-sexp-compile.
2013-01-16 10:11:46 +01:00
Noah Lavine
89c3c9ecf0
Make PEG Files
...
* module/ice-9/peg/using-parsers.scm: remove unnecessary dependency
* module/ice-9/peg.scm: add comment about string-peg dependency
* module/Makefile.scm: add PEG files to makefile
2013-01-16 10:11:45 +01:00
Noah Lavine
0977b03ef1
Rearrange PEG Modules
...
* module/ice-9/peg.scm: move code out of here
* module/ice-9/peg/match-records.scm: remove this file
* module/ice-9/peg/using-parsers.scm: make a new module with utilities for
using parsers. It contains the code from both peg.scm and match-records.scm
* module/ice-9/peg/string-peg.scm: update to use new module
2013-01-16 10:11:45 +01:00
Noah Lavine
22d4c9d99a
PEG Cache Module
...
* module/ice-9/peg/cache.scm: add module to hold cache logic for PEG
parsers
* module/ice-9/peg.scm: move cache logic out of here
2013-01-16 10:11:45 +01:00
Noah Lavine
172ac609c4
Update String PEGs
...
* module/ice-9/peg/string-peg.scm: use new interface for extending PEG
syntax
* module/ice-9/peg.scm: remove peg-extended-compile
2013-01-16 10:11:44 +01:00
Noah Lavine
94e8517c16
Extensible PEG Syntax
...
* module/ice-9/peg/codegen.scm: Make the PEG syntax extensible, and
move most of the current code generators to the new interface
* doc/ref/api-peg.texi: Document PEG extensions in the PEG Internals
section of the manual
2013-01-16 10:11:44 +01:00
Noah Lavine
bbc5564c42
Separate PEG Concerns
...
* module/ice-9/peg/codegen.scm: peg-sexp-compile no longer knows about
string PEGs
* module/ice-9/peg.scm: add a new function peg-extended-compile that
calls peg-sexp-compile or peg-string-compile on its argument as
appropriate
2013-01-16 10:11:44 +01:00
Noah Lavine
0afaf59982
Move define-nonterm
...
* module/ice-9/peg/string-peg.scm: remove define-nonterm and make a simpler
macro called `define-sexp-parser' to make the PEG grammar
* module/ice-9/peg.scm: move define-nonterm macro to this file
* module/ice-9/peg/codegen.scm: move code to wrap a parser result nicely to
this file, under name `wrap-parser-for-users'
2013-01-16 10:11:44 +01:00
Noah Lavine
97c846947d
Document PEG Internals
...
* doc/ref/api-peg.texi: add a manual section about the PEG internals.
2013-01-16 10:11:44 +01:00
Noah Lavine
74393a53cf
Remove eval-when
...
* module/ice-9/peg.scm: remove the eval-when statement
2013-01-16 10:11:43 +01:00
Noah Lavine
44bd21ae7b
Factor PEG Structure
...
* modules/ice-9/peg.scm: remove the part that defines a match structure
* modules/ice-9/peg/match-record.scm: and put it here
2013-01-16 10:11:43 +01:00
Noah Lavine
f3f41b9226
Factor PEG Functions
...
* module/ice-9/peg.scm: take out the functions for simplifying trees
* module/ice-9/peg/simplify-tree.scm: and put them here
2013-01-16 10:11:43 +01:00
Noah Lavine
5e16c41703
Separate PEG Strings
...
* module/ice-9/peg.scm: remove functions dealing with PEGs as strings
* module/ice-9/peg/string-peg.scm: and put them here
2013-01-16 10:11:43 +01:00
Noah Lavine
00923497d2
Make Macros Hygienic
...
* modules/ice-9/peg.scm: convert the unhygienic macros that generate code
for string PEGs to use hygiene.
2013-01-16 10:11:43 +01:00
Noah Lavine
86849e2c19
Rename in peg.scm
...
* module/ice-9/peg.scm: rename peg-parse-* functions to avoid confusion
with what PEGs do.
2013-01-16 10:11:42 +01:00
Noah Lavine
bff3ccd957
Split peg.scm
...
* module/ice-9/peg.scm: move code generators to new module
* module/ice-9/peg/codegen.scm: new module for PEG code generators
2013-01-16 10:11:42 +01:00
Andy Wingo
718bc349af
reformat and reflow api-peg.texi
...
* doc/ref/api-peg.texi: Reformat and reflow.
2013-01-16 10:11:42 +01:00
Andy Wingo
c7ed2190cf
peg: remove error-val
...
* module/ice-9/peg.scm (error-val): Remove needless definition.
2013-01-16 10:11:42 +01:00
Andy Wingo
3be2799eaf
peg: refactor peg-sexp-compile to operate on syntax directly
...
* module/ice-9/peg.scm (cg-generic-ret): Remove unused for-syntax
argument.
(peg-sexp-compile): Take the pattern as syntax directly, and use
syntax-case to destructure it and dispatch to the code generators.
(cg-and, cg-and-int, cg-or, cg-or-int): Refactor to operate on syntax
instead of on s-expressions.
(cg-body): Likewise; though this was a larger refactor.
(define-nonterm, peg-match): Adapt to peg-sexp-compile calling
convention change.
(peg-string-compile): Likewise, and just take the grammar as a syntax
object.
2013-01-16 10:11:41 +01:00
Andy Wingo
5041b82067
peg: cg-string, cg-peg-any, cg-range: remove needless for-syntax arg
...
* module/ice-9/peg.scm (cg-string, cg-peg-any, cg-range): Remove
unnecessary for-syntax arg.
(peg-sexp-compile): Adapt.
2013-01-16 10:11:41 +01:00
Andy Wingo
c5b85eceba
peg: change some instances of "match" to "pat"
...
* module/ice-9/peg.scm (cg-string): Rename "match" to "pat".
(peg-sexp-compile, cg-body-test, cg-body, define-nonterm): Likewise.
2013-01-16 10:11:40 +01:00
Andy Wingo
63a1336de7
remove cggl, cg-generic-lambda
...
* module/ice-9/peg.scm (cg-generic-lambda, cggl): Remove these helpers,
they are no longer needed.
(cg-generic-ret): Remove optimization for particular cg- routines, as
it's no longer needed.
2013-01-16 10:11:40 +01:00
Andy Wingo
e9722ec0aa
peg: more cggl / cggr excisions
...
* module/ice-9/peg.scm (cg-peg-any): Don't use cggr.
(cg-range): Don't use cggl or cggr.
2013-01-16 10:11:39 +01:00
Andy Wingo
102d022f53
peg: cg-string does not use cggr
...
* module/ice-9/peg.scm (cg-string): Don't use cggr. Interesting to see
what it actually generates.
2013-01-16 10:11:39 +01:00
Andy Wingo
67ac87f96d
peg: cg-peg-any does not use cggl
...
* module/ice-9/peg.scm (cg-peg-any): Don't use cggl.
2013-01-16 10:11:39 +01:00
Andy Wingo
7b746f4090
peg: cg-string without cggl
...
* module/ice-9/peg.scm (cg-string): Refactor to not use cggl.
2013-01-16 10:11:38 +01:00
Andy Wingo
990b24b254
peg: cg-string improvement
...
* module/ice-9/peg.scm (cg-string): Use the more efficient string= with
range args, rather than string=? and substring.
2013-01-16 10:11:38 +01:00
Andy Wingo
87c3ef2f95
peg: helper macro docstrings
...
* module/ice-9/peg.scm: Convert the helper macro comments into
docstrings.
2013-01-16 10:11:37 +01:00
Andy Wingo
09a6a7a44a
peg: module-ref cleanup
...
* module/ice-9/peg.scm (cg-generic-ret, cg-and-int, cg-body-test):
Remove a few needless @ or @@ forms.
2013-01-16 10:11:37 +01:00
Andy Wingo
49db248111
peg: remove get-code debugging foo
...
* module/ice-9/peg.scm (define-nonterm): Don't stash the code in a
symbol property.
(get-code): Remove.
2013-01-16 10:11:37 +01:00
Andy Wingo
a907bce657
peg: more syntax helper cleanup
...
* module/ice-9/peg.scm (single-filter, push-not-null!): Use
syntax-rules, and move outside the eval-when.
2013-01-16 10:11:36 +01:00
Andy Wingo
bb7ff21a77
peg: else for default cond clauses, not #t
...
* module/ice-9/peg.scm: Change default cases of `cond' to use `else'
instead of #t.
2013-01-16 10:11:36 +01:00
Andy Wingo
b5ebb8abad
peg; syntax helper cleanups
...
* module/ice-9/peg.scm (until, single?, push!): Move outside the
eval-when. Use syntax-rules, and single? is faster now.
2013-01-16 10:11:35 +01:00
Andy Wingo
3c8963de27
peg: cleanups
...
* module/ice-9/peg.scm (until): Rename from until-works, and be
functional (and faster).
(peg-match): Adapt.
2013-01-16 10:11:35 +01:00
Andy Wingo
0d2f21fc81
peg: define-module cleanup
...
* module/ice-9/peg.scm: Fix up define-module block.
2013-01-16 10:11:35 +01:00
Noah Lavine
9ca71e7b84
peg: let cleanups
...
* module/ice-9/peg.scm (cg-string, cg-peg-any, cg-range): Remove some
unnecessary lets.
2013-01-16 10:11:34 +01:00
Noah Lavine
18905baf6e
peg: remove unhygienic safe-bind, safe-bind-f
...
* module/ice-9/peg.scm (safe-bind, safe-bind-f): Remove.
2013-01-16 10:11:34 +01:00
Noah Lavine
ac8a071390
peg: remove unused nonhygienic expander helpers
...
* module/ice-9/peg.scm (cggl, cggr): Remove, and rename the cggl-syn and
cggr-syn to take their place.
2013-01-16 10:11:33 +01:00
Noah Lavine
84cb143eb4
peg: more helpers returning syntax
...
* module/ice-9/peg.scm (cg-body, cg-body-success, cg-body-more)
(cg-body-ret): Return syntax instead of s-expressions.
2013-01-16 10:11:33 +01:00
Noah Lavine
8e8de46ec6
peg: cg-or, cg-or-int return syntax
...
* module/ice-9/peg.scm (cg-or, cg-or-int): Return syntax instead of
s-expressions.
(peg-sexp-compile): Adapt.
2013-01-16 10:11:33 +01:00
Noah Lavine
00e227f779
peg: hygiene in cg-and, cg-and-int
...
* module/ice-9/peg.scm (cg-and, cg-and-int): Use cggr-syn instead of
cggr, and also return syntax now instead of s-expressions.
2013-01-16 10:11:32 +01:00
Noah Lavine
8b52357e88
peg: hygiene in cg-range
...
* module/ice-9/peg.scm (cg-range): Use cggl-syn and cggr-syn.
2013-01-16 10:11:32 +01:00
Noah Lavine
febe6dadab
peg: hygiene in cg-peg-any
...
* module/ice-9/peg.scm (cg-peg-any): Use cggl-syn and cggr-syn.
2013-01-16 10:11:31 +01:00