~jummit/rekkyo

A Scheme for use in Hare projects

9087a6c Sort imports

~jummit pushed to ~jummit/rekkyo git

a month ago

05dfe43 Consistent naming in std

~jummit pushed to ~jummit/rekkyo git

a month ago

#Rekkyo - 列挙

A Scheme implementation for embedding into / interacting with Hare projects.

#Installation

Dependencies: hare, madeline (on the $HAREPATH).

make
make check # run tests
make install # optionally specify a PREFIX

#Usage

rekkyo # start a REPL
rekkyo file.scm # evaluate the file

#Features

  • a REPL
  • primitives: cons, car, cdr, if, lambda, define, set!, call/cc
  • types: pairs, booleans, numbers (f64s only), strings, characters, vectors, continuations, userdata
  • a bytecode-VM
  • basic macro support

#What's Missing

  • more list, number, string and character functions
  • eval, apply
  • ports, file I/O
  • the numeric tower
  • built-in macros like or, and, let, let* and cond
  • dynamic-wind
  • block-comment syntax
  • delay / force
  • more documentation (code docs, man pages, manuals, examples)

#Usage from Hare

Using the language from Hare is its main selling point. But expect the interface to change significantly from the current one.

#Embedding Rekkyo

One option is to embed the interpreter into a Hare project:

use rekkyo;
use rekkyo::values::*;
use os;

export fn main() void = {
	let env = env { ... };
	defer env_finish(&env);
	rekkyo::load_builtins(&env);
	if (len(os::args) > 1) {
		match (eval::run(os::args[1], &env)) {
		case let err: !str => fmt::fprintln(os::stderr, err)!;
		case => yield;
    };
  };
};

#Extending Rekkyo

It's also possible to extend the language itself, which requires recompilation of this Hare module.

To do this, place a file into the rekkyo/extensions folder:

use fmt;
use rekkyo;
use rekkyo::values::*;
use rekkyo::unparse::{unparse};

fn socket_close(args: vector, env: *env) (value | !str) = {
	if (len(args) != 1) return "expected one argument": !str;
  fmt::println("hello", unparse(args[0]))!;
	return NIL;
};

@init fn register() void = {
	rekkyo::register([
		("hello-world", &hello_world),
	]);
};

#Contributing

The project is in an early state, but can already be dog-fed and should be in a state where gradual progress is possible. The codebase is small, and the implementation straight-forward in most places. Feel free to hack around and share your results in the mailing list!

#License

Rekkyo is licensed under the Mozilla Public License Version 2.0.