Move peg into gash/, compile.

This commit is contained in:
Jan Nieuwenhuizen 2018-11-11 21:45:37 +01:00
parent 2334e6ebde
commit 7483b27f55
9 changed files with 35 additions and 25 deletions

View File

@ -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

4
configure vendored
View File

@ -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 <<EOF
BASH=$BASH
GUILE=$GUILE
GUILE_TOOLS=$GUILE_TOOLS
GUILD=$GUILD
prefix=$PREFIX
bindir=$PREFIX/bin
docdir=$PREFIX/share/doc/gash

View File

@ -5,8 +5,9 @@
#:use-module (srfi srfi-8)
#:use-module (peg)
#:use-module (peg codegen)
#:use-module (gash gash)
#:use-module (gash peg)
#:use-module (gash peg codegen)
#:export (parse
parse-string))
@ -207,6 +208,8 @@
(let* ((match (match-pattern script input))
(end (peg:end match))
(tree (peg:tree match)))
(when (> %debug-level 0)
(pretty-print tree))
(if (eq? (string-length input) end)
tree
(if match

View File

@ -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

View File

@ -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

View File

@ -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))

View File

@ -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))

View File

@ -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)

View File

@ -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?))