1
0
Fork 0

Compromsie and add Gambit support as interpreter

This commit is contained in:
retropikzel 2025-12-11 10:29:01 +02:00
parent a959c5ea4b
commit d37b4b90b5
4 changed files with 47 additions and 79 deletions

View File

@ -102,6 +102,7 @@ test-r6rs:
mkdir -p ${R6RSTMP} mkdir -p ${R6RSTMP}
cp -r r6rs-testfiles/* ${R6RSTMP}/ cp -r r6rs-testfiles/* ${R6RSTMP}/
cd ${R6RSTMP} && COMPILE_R7RS=${SCHEME} compile-scheme -I ./libs -o main --debug main.sps cd ${R6RSTMP} && COMPILE_R7RS=${SCHEME} compile-scheme -I ./libs -o main --debug main.sps
cd ${R6RSTMP} && file main
cd ${R6RSTMP} && ./main 1 2 3 > test-result.txt cd ${R6RSTMP} && ./main 1 2 3 > test-result.txt
@grep "Test successfull (\"1\" \"2\" \"3\")" ${R6RSTMP}/test-result.txt || (echo "Test failed, output: " && cat ${R6RSTMP}/test-result.txt && exit 1) @grep "Test successfull (\"1\" \"2\" \"3\")" ${R6RSTMP}/test-result.txt || (echo "Test failed, output: " && cat ${R6RSTMP}/test-result.txt && exit 1)
@ -113,7 +114,8 @@ test-r7rs:
rm -rf ${R7RSTMP} rm -rf ${R7RSTMP}
mkdir -p ${R7RSTMP} mkdir -p ${R7RSTMP}
cp -r r7rs-testfiles/* ${R7RSTMP}/ cp -r r7rs-testfiles/* ${R7RSTMP}/
cd ${R7RSTMP} && COMPILE_R7RS=${SCHEME} compile-scheme -I ./libs --debug main.scm cd ${R7RSTMP} && COMPILE_R7RS=${SCHEME} compile-scheme -I ./libs -o main --debug main.scm
cd ${R7RSTMP} && file main
-cd ${R7RSTMP} && ./main 1 2 3 > test-result.txt 2>&1 -cd ${R7RSTMP} && ./main 1 2 3 > test-result.txt 2>&1
@grep "Test successfull (\"1\" \"2\" \"3\")" ${R7RSTMP}/test-result.txt || (echo "Test failed, output: " && cat ${R7RSTMP}/test-result.txt && exit 1) @grep "Test successfull (\"1\" \"2\" \"3\")" ${R7RSTMP}/test-result.txt || (echo "Test failed, output: " && cat ${R7RSTMP}/test-result.txt && exit 1)

View File

@ -24,7 +24,7 @@ DESCRIPTION
SUPPORTED IMPLEMENTATIONS SUPPORTED IMPLEMENTATIONS
Some implementations support both compiling and interpreting, in that Some implementations support both compiling and interpreting, in that
case only the compiler functionality is used and the implementation is case only the compiler functionality is used and the implementation is
marked as compiler. marked as compiler. Except currently with Gambit.
R6RS Compilers R6RS Compilers
loko loko

View File

@ -216,81 +216,47 @@
,args))))) ,args)))))
(gambit (gambit
(type . compiler) (type . compiler)
#;(library-command . ,(lambda (library-file prepend-directories append-directories r6rs?) (command . ,(lambda (exec-cmd
`(,(string-append "gsc -:search=" script-file
(apply string-append args
(map (lambda (item) input-file
(string-append item "/, ")) output-file
(append prepend-directories prepend-directories
append-directories))) append-directories
(search-library-file (append append-directories library-files
prepend-directories) r6rs?
library-file))))) compilation-target)
(command . ,(lambda (exec-cmd (let ((library-files-paths
script-file (map (lambda (item)
args (search-library-file (append prepend-directories
input-file append-directories)
output-file item))
prepend-directories library-files)))
append-directories `(,(string-append "echo \"#!/usr/bin/env gsi -:r7rs,search="
library-files (apply string-append
r6rs? (map (lambda (item)
compilation-target) (string-append item "/, "))
(let ((library-files-paths (append prepend-directories
(map (lambda (item) append-directories)))
(search-library-file (append prepend-directories "\" > "
append-directories) (string-append output-file ".tmp"))
item)) ,(string-append "cat "
library-files)) input-file
(link-file " >> "
(string-append (string-append output-file ".tmp"))
(string-cut-from-end input-file 4) "_.c"))) ,(apply string-append
`(,(string-append "gsc -:search=" `(" gsc "
(string-cut-from-end ,(util-getenv "COMPILE_R7RS_GAMBIT")
(apply string-append " -:r7rs,search="
(map (lambda (item) ,(apply string-append
(string-append item ",")) (map (lambda (item)
(append prepend-directories (string-append item "/, "))
append-directories))) (append prepend-directories
1) append-directories)))
" -link -flat -nopreload " " -o "
(string-cut-from-end ,output-file
(apply string-append " -exe -nopreload "
(map (lambda (item) ,(string-append output-file ".tmp"))))))))
(string-append item " "))
library-files-paths))
1)
" "
input-file)
,(string-append "gsc -:search="
(string-cut-from-end
(apply string-append
(map (lambda (item)
(string-append item ","))
(append prepend-directories
append-directories)))
1)
" -obj "
(apply string-append
(map (lambda (item)
(string-append (string-cut-from-end item 4) ".c "))
library-files-paths))
" "
(string-append (string-cut-from-end input-file 4) ".c")
" "
(string-append (string-cut-from-end input-file 4) "_.c"))
,(string-append "gcc -o "
output-file
" "
(apply string-append
(map (lambda (item)
(string-append (string-cut-from-end item 4) ".o "))
library-files-paths))
" "
(string-append (string-cut-from-end input-file 4) ".o")
" "
(string-append (string-cut-from-end input-file 4) "_.o"))
)))))
(gauche (gauche
(type . interpreter) (type . interpreter)
(command . ,(lambda (exec-cmd (command . ,(lambda (exec-cmd

View File

@ -67,9 +67,9 @@
chibi chibi
chicken chicken
cyclone cyclone
;gambit
foment foment
gauche gauche
gambit
guile guile
kawa kawa
larceny larceny
@ -88,8 +88,8 @@
chibi chibi
chicken chicken
cyclone cyclone
;gambit
foment foment
gambit
gauche gauche
guile guile
ikarus ikarus