Prepare for 0.1 release: installable scripts.

* scripts/mes: New symlink.
* scripts/elf.mes: Use it.
* scripts/mescc.mes: Likewise, read all mes modules with include.mes.
* scripts/paren.mes: Likewise.
* scripts/repl.mes: Likewise.
This commit is contained in:
Jan Nieuwenhuizen 2016-10-16 08:00:04 +02:00
parent 3128c4b976
commit 323e78b190
6 changed files with 18 additions and 7 deletions

View file

@ -1,6 +1,6 @@
#! /bin/sh
# -*-scheme-*-
cat $($(dirname $0)/include.mes $0) $0 /dev/stdin | ./mes > a.out
cat $($(dirname $0)/include.mes $0) $0 /dev/stdin | $(dirname $0)/mes > a.out
chmod +x a.out
exit $?
!#

View file

@ -1,6 +1,11 @@
#! /bin/sh
for prefix in $(dirname $(dirname $0))/share/mes . $(dirname $(dirname $0)); do
if [ -d ${prefix}/module ]; then
break;
fi
done
cat $1 \
| grep -Eo '(mes-use-module \([^()]+ [^()]+))' \
| grep -Eo ' \([^)]+\)' \
| sed -e 's@^ *(@module/@' -e 's@ @/@g' -e 's@)@.mes@'
| sed -e "s@^ *(@${prefix}/module/@" -e 's@ @/@g' -e 's@)@.mes@'

1
scripts/mes Symbolic link
View file

@ -0,0 +1 @@
../mes

View file

@ -1,6 +1,6 @@
#! /bin/sh
# -*-scheme-*-
cat cc/main.c | cat $($(dirname $0)/include.mes $0) cc/c-lexer.mes cc/mescc.mes $0 /dev/stdin | ./mes > a.out
cat ${1-$(dirname $(dirname $0))/share/doc/mes/examples/main.c} | cat $($(dirname $0)/include.mes $0) $0 /dev/stdin | $(dirname $0)/mes > a.out
chmod +x a.out
exit $?
!#
@ -29,7 +29,7 @@ exit $?
;;;
;;; Run with Guile:
;;; make guile-mescc
;;; BROKEN? cat cc/main.c | guile -s <(echo '(compile)' | cat guile/mes-0.scm module/mes/lalr.mes module/rnrs/bytevectors.mes module/srfi/srfi-1.mes module/mes/elf.mes module/mes/libc-i386.mes cc/c-lexer.mes cc/mescc.mes -)
;;; BROKEN? cat doc/examples/main.c | guile -s <(echo '(compile)' | cat guile/mes-0.scm module/mes/lalr.mes module/mes/elf.mes module/mes/libc-i386.mes module/rnrs/bytevectors.mes module/language/c/lexer.mes module/language/c/parser.mes module/language/c/compiler.mes -)
;;; Code:
@ -54,5 +54,9 @@ exit $?
(mes-use-module (mes elf))
(mes-use-module (mes libc-i386))
(mes-use-module (language c lexer))
(mes-use-module (language c parser))
(mes-use-module (language c compiler))
(compile)
()

View file

@ -1,6 +1,6 @@
#! /bin/sh
# -*-scheme-*-
echo -e 'EOF\n___P((()))' | cat $($(dirname $0)/include.mes $0) cc/paren.mes $0 /dev/stdin | ./mes
echo -e 'EOF\n___P((()))' | cat $($(dirname $0)/include.mes $0) $0 /dev/stdin | $(dirname $0)/mes
chmod +x a.out
exit $?
!#
@ -30,7 +30,7 @@ exit $?
;;; Gambit wiki.
;;;
;;; Run with Guile:
;;; echo '___P((()))' | guile -s <(echo '(paren-depth)' | cat cc/paren.mes -)
;;; echo '___P((()))' | guile -s <(echo '(paren-depth)' | cat module/language/paren.mes -)
;;; Code:
@ -46,6 +46,7 @@ exit $?
(mes-use-module (srfi srfi-9))
(mes-use-module (mes lalr-0))
(mes-use-module (mes lalr))
(mes-use-module (language paren))
(paren-depth)
()

View file

@ -1,6 +1,6 @@
#! /bin/sh
# -*-scheme-*-
cat $($(dirname $0)/include.mes $0) $0 /dev/stdin | ./mes
cat $($(dirname $0)/include.mes $0) $0 /dev/stdin | $(dirname $0)/mes
exit $?
!#