From 7483b27f5544c04419d19017936d6a685c4f98b6 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Sun, 11 Nov 2018 21:45:37 +0100 Subject: [PATCH] Move peg into gash/, compile. --- build-aux/build-guile.sh | 15 +++++++++++---- configure | 4 ++-- gash/grammar.scm | 7 +++++-- peg.scm => gash/peg.scm | 12 ++++++------ {peg => gash/peg}/cache.scm | 2 +- {peg => gash/peg}/codegen.scm | 2 +- {peg => gash/peg}/simplify-tree.scm | 2 +- {peg => gash/peg}/string-peg.scm | 8 ++++---- {peg => gash/peg}/using-parsers.scm | 8 ++++---- 9 files changed, 35 insertions(+), 25 deletions(-) rename peg.scm => gash/peg.scm (87%) rename {peg => gash/peg}/cache.scm (98%) rename {peg => gash/peg}/codegen.scm (99%) rename {peg => gash/peg}/simplify-tree.scm (98%) rename {peg => gash/peg}/string-peg.scm (98%) rename {peg => gash/peg}/using-parsers.scm (96%) diff --git a/build-aux/build-guile.sh b/build-aux/build-guile.sh index 10529a1..ff32da8 100755 --- a/build-aux/build-guile.sh +++ b/build-aux/build-guile.sh @@ -24,7 +24,7 @@ srcdir=${srcdir-.} export GUILE export GUILE_AUTO_COMPILE GUILE=${GUILE-$(command -v guile)} -GUILE_TOOLS=${GUILE_TOOLS-$(command -v guile-tools)} +GUILD=${GUILD-$(command -v guild || command -v guile-tools)} GUILE_AUTO_COMPILE=0 set -e @@ -36,12 +36,12 @@ ${srcdest}gash/builtins.scm ${srcdest}gash/compress.scm ${srcdest}gash/config.scm ${srcdest}gash/environment.scm -${srcdest}gash/geesh.scm ${srcdest}gash/gash.scm +${srcdest}gash/geesh.scm +${srcdest}gash/grammar.scm ${srcdest}gash/io.scm ${srcdest}gash/job.scm ${srcdest}gash/lzw.scm -${srcdest}gash/peg.scm ${srcdest}gash/pipe.scm ${srcdest}gash/readline.scm ${srcdest}gash/script.scm @@ -49,6 +49,13 @@ ${srcdest}gash/shell-utils.scm ${srcdest}gash/ustar.scm ${srcdest}gash/util.scm +${srcdest}gash/peg.scm +${srcdest}gash/peg/cache.scm +${srcdest}gash/peg/codegen.scm +${srcdest}gash/peg/simplify-tree.scm +${srcdest}gash/peg/string-peg.scm +${srcdest}gash/peg/using-parsers.scm + ${srcdest}gash/commands/basename.scm ${srcdest}gash/commands/cat.scm ${srcdest}gash/commands/chmod.scm @@ -116,6 +123,6 @@ for i in $SCM_FILES $SCRIPTS; do b=$(basename $i) go=${i%%.scm}.go if [ $i -nt $go ]; then - trace "GUILEC $b" $GUILE_TOOLS compile -L ${srcdir} $WARNINGS -o $go $i + trace "GUILEC $b" $GUILD compile -L ${srcdir} $WARNINGS -o $go $i fi done diff --git a/configure b/configure index a8f0c51..5c43d4e 100755 --- a/configure +++ b/configure @@ -13,7 +13,7 @@ fi BASH=$(command -v bash) GUILE=${GUILE-$(command -v guile)} -GUILE_TOOLS=${GUILE_TOOLS-$(command -v guile-tools)} +GUILD=${GUILD-$(command -v guild || command -v guile-tools)} guile_site_dir=$PREFIX/share/guile/site/$guile_effective_version guile_site_ccache_dir=$PREFIX/lib/guile/$guile_effective_version/site-ccache guile_effective_version=$(guile -c '(display (effective-version))') @@ -39,7 +39,7 @@ abs_top_builddir=$PWD cat > .config.make < %debug-level 0) + (pretty-print tree)) (if (eq? (string-length input) end) tree (if match diff --git a/peg.scm b/gash/peg.scm similarity index 87% rename from peg.scm rename to gash/peg.scm index 9b953e9..5d6ab04 100644 --- a/peg.scm +++ b/gash/peg.scm @@ -17,15 +17,15 @@ ;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ;;;; -(define-module (peg) - #:use-module (peg codegen) - #:use-module (peg string-peg) +(define-module (gash peg) + #:use-module (gash peg codegen) + #:use-module (gash peg string-peg) ;; Note: the most important effect of using string-peg is not whatever ;; functions it exports, but the fact that it adds a new handler to ;; peg-sexp-compile. - #:use-module (peg simplify-tree) - #:use-module (peg using-parsers) - #:use-module (peg cache) + #:use-module (gash peg simplify-tree) + #:use-module (gash peg using-parsers) + #:use-module (gash peg cache) #:re-export (define-peg-pattern define-peg-string-patterns match-pattern diff --git a/peg/cache.scm b/gash/peg/cache.scm similarity index 98% rename from peg/cache.scm rename to gash/peg/cache.scm index e66291d..fd192b7 100644 --- a/peg/cache.scm +++ b/gash/peg/cache.scm @@ -17,7 +17,7 @@ ;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ;;;; -(define-module (peg cache) +(define-module (gash peg cache) #:export (cg-cached-parser)) ;; The results of parsing using a nonterminal are cached. Think of it like a diff --git a/peg/codegen.scm b/gash/peg/codegen.scm similarity index 99% rename from peg/codegen.scm rename to gash/peg/codegen.scm index 150f5a7..9b91474 100644 --- a/peg/codegen.scm +++ b/gash/peg/codegen.scm @@ -17,7 +17,7 @@ ;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ;;;; -(define-module (peg codegen) +(define-module (gash peg codegen) #:export (compile-peg-pattern wrap-parser-for-users add-peg-compiler!) #:use-module (ice-9 pretty-print) #:use-module (system base pmatch)) diff --git a/peg/simplify-tree.scm b/gash/peg/simplify-tree.scm similarity index 98% rename from peg/simplify-tree.scm rename to gash/peg/simplify-tree.scm index 630d93c..264e29e 100644 --- a/peg/simplify-tree.scm +++ b/gash/peg/simplify-tree.scm @@ -17,7 +17,7 @@ ;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ;;;; -(define-module (peg simplify-tree) +(define-module (gash peg simplify-tree) #:export (keyword-flatten context-flatten string-collapse) #:use-module (system base pmatch)) diff --git a/peg/string-peg.scm b/gash/peg/string-peg.scm similarity index 98% rename from peg/string-peg.scm rename to gash/peg/string-peg.scm index 0943fa8..8797bec 100644 --- a/peg/string-peg.scm +++ b/gash/peg/string-peg.scm @@ -17,13 +17,13 @@ ;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ;;;; -(define-module (peg string-peg) +(define-module (gash peg string-peg) #:export (peg-as-peg define-peg-string-patterns peg-grammar) - #:use-module (peg using-parsers) - #:use-module (peg codegen) - #:use-module (peg simplify-tree)) + #:use-module (gash peg using-parsers) + #:use-module (gash peg codegen) + #:use-module (gash peg simplify-tree)) ;; Gets the left-hand depth of a list. (define (depth lst) diff --git a/peg/using-parsers.scm b/gash/peg/using-parsers.scm similarity index 96% rename from peg/using-parsers.scm rename to gash/peg/using-parsers.scm index 9a141fd..fb8d736 100644 --- a/peg/using-parsers.scm +++ b/gash/peg/using-parsers.scm @@ -17,10 +17,10 @@ ;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ;;;; -(define-module (peg using-parsers) - #:use-module (peg simplify-tree) - #:use-module (peg codegen) - #:use-module (peg cache) +(define-module (gash peg using-parsers) + #:use-module (gash peg simplify-tree) + #:use-module (gash peg codegen) + #:use-module (gash peg cache) #:export (match-pattern define-peg-pattern search-for-pattern prec make-prec peg:start peg:end peg:string peg:tree peg:substring peg-record?))