73 lines
2.4 KiB
Markdown
73 lines
2.4 KiB
Markdown
# Benz
|
|
|
|
Benz is a super tiny scheme interpreter intended to be embedded in other applications such as game engine and network server. It provides a subset language of R7RS with several useful extensions. By default, Benz just contains some C files and headers and this README file. In embedding, you only need to copy the files into the project and add `include` dir to the include path.
|
|
|
|
Originally, Benz used to be the core component of [Picrin Scheme](https://github.com/picrin-scheme/picrin). They are currently maintained at separate repositories.
|
|
|
|
## Example
|
|
|
|
```c
|
|
#include <stdio.h>
|
|
|
|
#include "picrin.h"
|
|
|
|
/* Simple REPL program */
|
|
|
|
int
|
|
main(int argc, char *argv[])
|
|
{
|
|
pic_state *pic;
|
|
pic_value expr;
|
|
|
|
pic = pic_open(argc, argv, NULL);
|
|
|
|
pic_import_library(pic, pic->PICRIN_BASE);
|
|
|
|
while (1) {
|
|
printf("> ");
|
|
|
|
expr = pic_read(pic, pic_stdin(pic));
|
|
|
|
if (pic_eof_p(expr)) {
|
|
break;
|
|
}
|
|
|
|
pic_printf(pic, "~s\n", pic_eval(pic, expr, pic->lib));
|
|
}
|
|
|
|
pic_close(pic);
|
|
|
|
return 0;
|
|
}
|
|
```
|
|
|
|
## Language
|
|
|
|
All procedures and syntaces are exported from a single library named `(picrin base)`. The complete list is found at https://gist.github.com/wasabiz/344d802a2340d1f734b7 .
|
|
|
|
## Authors
|
|
|
|
See https://github.com/picrin-scheme/benz and https://github.com/picrin-scheme/picrin for details.
|
|
|
|
## LICENSE
|
|
|
|
Copyright (c) 2013-2014 Yuichi Nishiwaki and other picrin contributors
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
this software and associated documentation files (the "Software"), to deal in
|
|
the Software without restriction, including without limitation the rights to
|
|
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
subject to the following conditions:
|
|
|
|
The above copyright notice and this permission notice shall be included in all
|
|
copies or substantial portions of the Software.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|