Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Guile support for Scheme implementation #629

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions IMPLS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ IMPL:
- {IMPL: scheme, scheme_MODE: sagittarius}
- {IMPL: scheme, scheme_MODE: cyclone}
# - {IMPL: scheme, scheme_MODE: foment}
- {IMPL: scheme, scheme_MODE: guile}
- {IMPL: skew}
- {IMPL: sml, sml_MODE: polyml}
- {IMPL: sml, sml_MODE: mlton}
Expand Down
3 changes: 2 additions & 1 deletion Makefile.impls
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ d_MODE = gdc
haxe_MODE = neko
# octave or matlab
matlab_MODE = octave
# scheme (chibi, kawa, gauche, chicken, sagittarius, cyclone, foment)
# scheme (chibi, kawa, gauche, chicken, sagittarius, cyclone, foment, guile)
scheme_MODE = chibi
# sml (polyml, mlton, mosml)
sml_MODE = polyml
Expand Down Expand Up @@ -104,6 +104,7 @@ scheme_STEP_TO_PROG_chicken = impls/scheme/$($(1))
scheme_STEP_TO_PROG_sagittarius = impls/scheme/$($(1)).scm
scheme_STEP_TO_PROG_cyclone = impls/scheme/$($(1))
scheme_STEP_TO_PROG_foment = impls/scheme/$($(1)).scm
scheme_STEP_TO_PROG_guile = impls/scheme/$($(1)).scm

# Map of step (e.g. "step8") to executable file for that step
ada_STEP_TO_PROG = impls/ada/$($(1))
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1061,7 +1061,7 @@ scala -classpath target/scala*/classes stepX_YYY

The Scheme implementation of MAL has been tested with Chibi-Scheme
0.10, Kawa 3.1.1, Gauche 0.9.6, CHICKEN 5.1.0, Sagittarius 0.9.7,
Cyclone 0.32.0 (Git version) and Foment 0.4 (Git version). You should
Cyclone 0.32.0 (Git version), Foment 0.4 (Git version) and Guile 3.0.1. You should
be able to get it running on other conforming R7RS implementations
after figuring out how libraries are loaded and adjusting the
`Makefile` and `run` script accordingly.
Expand All @@ -1085,6 +1085,8 @@ make cyclone
scheme_MODE=cyclone ./run
# foment
scheme_MODE=foment ./run
# guile
scheme_MODE=guile ./run
```

### Skew ###
Expand Down
2 changes: 1 addition & 1 deletion docs/graph/base_data.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ languages:
- [ruby , Ruby , OTHER , Dynamic , []]
- [rust , Rust , C , Static , []]
- [scala , Scala , C , Static , []]
- [scheme , Scheme (R7RS) , Lisp , Dynamic , [chibi,kawa,gauche,chicken,sagittarius,cyclone,foment]]
- [scheme , Scheme (R7RS) , Lisp , Dynamic , [chibi,kawa,gauche,chicken,sagittarius,cyclone,foment,guile]]
- [skew , Skew , OTHER , Static , []]
- [swift , Swift 2 , C , Static , []]
- [swift3 , Swift 3 , C , Static , []]
Expand Down
6 changes: 3 additions & 3 deletions impls/scheme/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:focal
FROM ubuntu:22.04
MAINTAINER Joel Martin <github@martintribe.org>

##########################################################
Expand All @@ -9,7 +9,7 @@ MAINTAINER Joel Martin <github@martintribe.org>
RUN apt-get -y update

# Required for running tests
RUN apt-get -y install make python
RUN apt-get -y install make python3 python-is-python3

# Some typical implementation and test requirements
RUN apt-get -y install curl libreadline-dev libedit-dev
Expand All @@ -25,7 +25,7 @@ WORKDIR /mal
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install gcc g++ bison flex groff make cmake pkg-config git

# Prepackaged Scheme implementations
RUN apt-get -y install gauche chicken-bin
RUN apt-get -y install gauche chicken-bin guile-3.0
RUN chicken-install r7rs

# Chibi
Expand Down
8 changes: 7 additions & 1 deletion impls/scheme/lib/util.sld
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,19 @@

(begin

;; HACK: cyclone currently implements error the SICP way
(cond-expand
;; HACK: cyclone currently implements error the SICP way
(cyclone
(define (error-object? x) (and (pair? x) (string? (car x))))
(define read-error? error-object?)
(define error-object-message car)
(define error-object-irritants cdr))
;; HACK: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=62464
(guile
(define %error-object-irritants error-object-irritants)
(set! error-object-irritants
(lambda (ex)
(or (%error-object-irritants ex) '()))))
(else))

(define (call-with-input-string string proc)
Expand Down
15 changes: 8 additions & 7 deletions impls/scheme/run
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@ elif [[ $(which sagittarius 2>/dev/null) ]]; then
fi

case ${scheme_MODE:-chibi} in
chibi) exec chibi-scheme -I$basedir $basedir/$step.scm "${@}" ;;
kawa) exec java -cp $kawa:$basedir/out $step "${@}" ;;
gauche) exec gosh -I$basedir $basedir/$step.scm "${@}" ;;
chicken) CHICKEN_REPOSITORY=$basedir/eggs exec $basedir/$step "${@}" ;;
sagittarius) exec $sagittarius -n -L$basedir $basedir/$step.scm "${@}" ;;
cyclone) exec $basedir/$step "${@}" ;;
foment) exec foment $basedir/$step.scm "${@}" ;;
chibi) exec chibi-scheme -I$basedir $basedir/$step.scm "${@}" ;;
kawa) exec java -cp $kawa:$basedir/out $step "${@}" ;;
gauche) exec gosh -I$basedir $basedir/$step.scm "${@}" ;;
chicken) CHICKEN_REPOSITORY=$basedir/eggs exec $basedir/$step "${@}" ;;
sagittarius) exec $sagittarius -n -L$basedir $basedir/$step.scm "${@}" ;;
cyclone) exec $basedir/$step "${@}" ;;
foment) exec foment $basedir/$step.scm "${@}" ;;
guile) exec guile -L $basedir -x .sld --r7rs -s $basedir/$step.scm "${@}" ;;
*) echo "Invalid scheme_MODE: ${scheme_MODE}"; exit 2 ;;
esac
Loading