Gerbil as Gambit modules
  • Scheme 94.1%
  • Tree-sitter Query 5.3%
  • Shell 0.6%
Find a file
vyzo 877fc2c881
update README
reexports are working!
2024-03-08 15:53:09 +02:00
.gitignore Initial Implementation/Demo (#1) 2024-03-08 11:04:56 +02:00
build.ss Re-exports are actually working (#2) 2024-03-08 15:39:46 +02:00
demo.scm fix goodbye in demo script 2024-03-08 11:14:07 +02:00
install.sh Re-exports are actually working (#2) 2024-03-08 15:39:46 +02:00
LICENSE Initial commit 2024-03-07 11:17:24 +02:00
README.md update README 2024-03-08 15:53:09 +02:00

Gerbil as Gambit modules

This repo provides support for using Gerbil runtime modules as gambit modules, so that they can be integrated in pure gambit programs.

Build and Usage

First, you need to install Gerbil in your system. Please use master, after some required fixes. Your Gambit should also be master, as Marc a blocking issue with the module cache.

Then just run the build.ss script:

./build.ss

This will generate and compile the gerbil and std module structure in modules. Next, you can install to ~/.gambit_userlib by running the install script:

./install.sh

Limitations

There are a few limitations:

  • only the runtime code is present, no macros; that's hard to fix, but we'll get to it eventually.
  • the built modules do not include the expander or compiler; things that depend on them (macros or tools mostly) just won't work.

Note I have only tested this on Linux; your mileage may vary in other systems.

Demo

Here is a small example script that uses getopt to parse arguments:

$ cat demo.scm
#!/usr/bin/env gsi

(import (std cli getopt))

(define (main . args)
  (call-with-getopt demo-main args
                    program: "demo"
                    help: "a small demo script"
                    (command "hello" help: "say hello")
                    (command "goodbye" help: "say goodbye")))

(define (demo-main cmd opt)
  (case cmd
    ((hello) (display "hello, ") (display (getenv "USER")) (newline))
    ((goodbye) (display "goodbye, ") (display (getenv "USER")) (newline))))

$ gsi demo.scm
Error: Missing command

demo: a small demo script

Usage: demo  <command> command-arg ...

Commands:
 hello                            say hello
 goodbye                          say goodbye
 help                             display help; help <command> for command help

$ gsi demo.scm hello
hello, vyzo
$ gsi demo.scm goodbye
goodbye, vyzo