Resurrect guile-mescc with guile-2.1.5.

* scripts/include.mes: Grep all files.
* GNUmakefile (mescc.cat): Update for mes-use-module; list all toplevel inputs.
* module/language/c/lexer.mes: Use (system base lalr).
* module/language/c/parser.mes: Likewise.
* module/language/c/compiler.mes: Likewise.  Remove encoding on output port.
* scripts/mescc.mes: Remove BROKEN comment.
This commit is contained in:
Jan Nieuwenhuizen 2016-12-17 10:57:38 +01:00
parent a36896662e
commit d4dc29c498
7 changed files with 22 additions and 12 deletions

View file

@ -4,6 +4,8 @@ default: all
.config.make: configure GNUmakefile .config.make: configure GNUmakefile
./configure ./configure
GUILE:=guile
export GUILE
OUT:=out OUT:=out
CFLAGS:=-std=c99 -O3 -finline-functions CFLAGS:=-std=c99 -O3 -finline-functions
#CFLAGS:=-std=c99 -O0 #CFLAGS:=-std=c99 -O0
@ -88,16 +90,18 @@ guile-check:
MAIN_C:=doc/examples/main.c MAIN_C:=doc/examples/main.c
mescc: all mescc: all
rm -f a.out
scripts/mescc.mes $(MAIN_C) scripts/mescc.mes $(MAIN_C)
./a.out ./a.out; r=$$?; [ $$r = 42 ]
mescc.cat: $(MES-0) module/mes/lalr.mes module/mes/elf.mes module/mes/libc-i386.mes $(shell scripts/include.mes scripts/mescc.mes | grep -Ev '/mes/|/srfi/') mescc.cat: all $(MES-0) module/rnrs/bytevectors.mes module/mes/elf.mes module/mes/libc-i386.mes module/language/c/lexer.mes module/language/c/parser.mes module/language/c/compiler.mes
echo '(compile)' | cat $^ - > $@ echo '(compile)' | cat $(filter %.scm %.mes, $^) - > $@
guile-mescc: mescc.cat guile-mescc: mescc.cat
cat $(MAIN_C) | guile -s $^ > a.out rm -f a.out
cat $(MAIN_C) | $(GUILE) -s $^ > a.out
chmod +x a.out chmod +x a.out
./a.out ./a.out; r=$$?; [ $$r = 42 ]
paren: all paren: all
scripts/paren.mes scripts/paren.mes

View file

@ -4,5 +4,5 @@ int main ()
puts ("Hi Mes!\n"); puts ("Hi Mes!\n");
for (i = 0; i < 4; ++i) for (i = 0; i < 4; ++i)
puts (" Hello, world!\n"); puts (" Hello, world!\n");
return 1; return 42;
} }

View file

@ -25,6 +25,15 @@
;;; Code: ;;; Code:
(cond-expand
(guile
(use-modules (srfi srfi-1))
(use-modules (system base lalr))
(use-modules (ice-9 match))
(set-port-encoding! (current-output-port) "ISO-8859-1"))
(mes
(mes-use-module (mes lalr))))
(mes-use-module (mes elf)) (mes-use-module (mes elf))
(mes-use-module (mes libc-i386)) (mes-use-module (mes libc-i386))
(mes-use-module (mes match)) (mes-use-module (mes match))

View file

@ -55,6 +55,7 @@
(cond-expand (cond-expand
(guile (guile
(use-modules (system base lalr))
;; (use-modules (ice-9 rdelim)) ;; (use-modules (ice-9 rdelim))
(define (syntax-error what loc form . args) (define (syntax-error what loc form . args)

View file

@ -27,10 +27,7 @@
(cond-expand (cond-expand
(guile (guile
;;(use-modules (srfi srfi-1)) (use-modules (system base lalr)))
(use-modules (system base lalr))
;;(use-modules (ice-9 match))
)
(mes (mes
(mes-use-module (mes lalr)))) (mes-use-module (mes lalr))))

View file

@ -17,7 +17,7 @@ if [ -n "$BOOT" ]; then
fi fi
echo $prefix/module/mes/mes-0.mes echo $prefix/module/mes/mes-0.mes
fi fi
cat $1 \ cat $@ \
| grep -Eo '^\(mes-use-module \([^ ()]+ [^()]+))' \ | grep -Eo '^\(mes-use-module \([^ ()]+ [^()]+))' \
| grep -Eo ' \([^)]+\)' \ | grep -Eo ' \([^)]+\)' \
| sed -e "s@^ *(@${prefix}/module/@" -e 's@ @/@g' -e 's@)@.mes@' | sed -e "s@^ *(@${prefix}/module/@" -e 's@ @/@g' -e 's@)@.mes@'

View file

@ -30,7 +30,6 @@ exit $?
;;; ;;;
;;; Run with Guile: ;;; Run with Guile:
;;; make guile-mescc ;;; make guile-mescc
;;; 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: ;;; Code: