picrin/README.md

128 lines
5.0 KiB
Markdown
Raw Normal View History

2013-10-17 01:09:39 -04:00
2013-10-19 14:20:41 -04:00
This product is developed at the second-grade course, Informatic Science
Basic Experiment class at the University of Tokyo.
2013-10-17 01:09:39 -04:00
# Picrin - a lightweight scheme interpreter
2013-11-07 08:16:04 -05:00
## Features
2013-10-17 01:09:39 -04:00
- R7RS compatibility (but partial support)
- reentrant design (all VM states are stored in single global state object)
- bytecode interpreter (based on Stack VM technology)
2013-10-17 08:03:23 -04:00
- direct threaded VM
2013-11-05 07:16:17 -05:00
- Internal representation by Nan-Boxing
- conservative call/cc implementation (users can freely interleave native stack with VM stack)
2013-10-17 01:09:39 -04:00
- exact GC (simple mark and sweep strategy)
2013-10-17 07:53:39 -04:00
- advanced REPL support (multi-line input, etc)
2013-10-20 08:44:31 -04:00
- tiny & portable library (all functions will be in `libpicrin.so`)
2013-10-17 01:09:39 -04:00
2013-11-13 23:57:53 -05:00
## Supported Range
| section | status | comments |
| --- | --- | --- |
2013-11-13 23:57:53 -05:00
| 2.2 Whitespace and comments | incomplete | block comments are not implemented |
| 2.3 Other notations | incomplete | #e #i #b #o #d #x |
| 2.4 Datum labels | no | unsupported |
| 3.1 Variables, syntactic keywords, and regions | | |
| 3.2 Disjointness of types | yes | |
| 3.3 External representations | | |
| 3.4 Storage model | yes | |
| 3.5 Proper tail recursion | incomplete | apply, call/cc, call/values, eval are not yet |
| 4.1.1 Variable references | yes | |
| 4.1.2 Literal expressions | yes | |
2013-11-13 23:57:53 -05:00
| 4.1.3 Procedure calls | yes | In picrin `()` is self-evaluating |
| 4.1.4 Procedures | yes | |
| 4.1.5 Conditionals | yes | In picrin `(if #f #f)` returns `#f` |
| 4.1.6 Assignments | yes | |
2013-11-13 23:57:53 -05:00
| 4.1.7 Inclusion | no | `include` and `include-ci` |
| 4.2.1 Conditionals | incomplete | TODO: `cond-expand` |
| 4.2.2 Binding constructs | incomplete | TODO: `let-values`, `let*-values` |
| 4.2.3 Sequencing | yes | |
2013-11-14 03:42:07 -05:00
| 4.2.4 Iteration | yes | TODO: `do` is unsafe when nested |
2013-11-13 23:57:53 -05:00
| 4.2.5 Delayed evaluation | N/A | |
| 4.2.6 Dynamic bindings | no | TODO: `make-parameter`, `parameterize` in C level |
| 4.2.7 Exception handling | no | `guard` syntax. |
| 4.2.8 Quasiquotation | incomplete | nested is unsupported |
| 4.2.9 Case-lambda | N/A | |
| 4.3.1 Bindings constructs for syntactic keywords | no | Instead, picrin provides so-called legacy macro facility (`define-macro`). |
2013-11-14 04:17:50 -05:00
| 4.3.2 Pattern language | -- | see above. |
| 4.3.3 Signaling errors in macro transformers | -- | see above. |
2013-11-13 23:57:53 -05:00
| 5.1 Programs | yes | |
| 5.2 Import declarations | no | |
| 5.3.1 Top level definitions | yes | |
2013-11-14 04:17:50 -05:00
| 5.3.2 Internal definitions | yes | TODO: interreferential definitions |
2013-11-13 23:57:53 -05:00
| 5.3.3 Multiple-value definitions | no | |
2013-11-14 04:17:50 -05:00
| 5.4 Syntax definitions | -- | see notes on section 4.3.1. |
2013-11-13 23:57:53 -05:00
| 5.5 Recored-type definitions | no | |
| 5.6.1 Library Syntax | no | |
| 5.6.2 Library example | N/A | |
| 5.7 The REPL | yes | |
2013-11-14 00:17:41 -05:00
| 6.1 Equivalence predicates | yes | |
| 6.2.1 Numerical types | yes | picrin has only two types of internal representation of numbers: fixnum and double float. It still comforms the R7RS spec. |
| 6.2.2 Exactness | yes | |
| 6.2.3 Implementation restrictions | yes | |
| 6.2.4 Implementation extensions | yes | |
| 6.2.5 Syntax of numerical constants | yes | |
| 6.2.6 Numerical operations | yes | `denominator`, `numerator`, and `rationalize` are not supported for now. Also, picrin does not provide complex library procedures. |
2013-11-14 00:17:41 -05:00
| 6.2.7 Numerical input and output | no | |
2013-11-14 00:31:57 -05:00
| 6.3 Booleans | yes | |
2013-11-14 00:17:41 -05:00
| 6.4 Pairs and lists | yes | |
2013-11-14 02:52:10 -05:00
| 6.5 Symbols | yes | |
2013-11-14 00:17:41 -05:00
| 6.6 Characters | incomplete | TODO: almost all functions in the section :-( |
| 6.7 Strings | incomplete | |
| 6.8 Vectors | incomplete | TODO: `vector-copy`, ...etc |
| 6.9 Bytevectors | incomplete | TODO: string<->utf8 conversion, etc |
| 6.10 Control features | incomplete | TODO: `string-map`, `vector-map`, ...etc |
| 6.11 Exceptions | no | |
| 6.12 Environments and evaluation | no | |
| 6.13 Ports | incomplete | |
| 6.14 System interface | incomplete | `exit` is unsafe when used with dynamic-wind |
2013-11-13 23:57:53 -05:00
2013-10-19 14:20:41 -04:00
## Homepage
Currently picrin is hosted on Github. You can freely send a bug report or pull-request, and fork the repository.
https://github.com/wasabiz/picrin
2013-10-17 01:09:39 -04:00
## How to use it
- build
$ make build
2013-10-20 05:49:35 -04:00
built executable binary will be under bin/ directory and shared library `libpicrin.so` under lib/.
2013-10-17 01:09:39 -04:00
- run
Simply directly run the binary `bin/picrin` from terminal, or you can use `make` to execute it like this.
$ make run
2013-11-13 23:57:28 -05:00
- debug-run
By default make command runs REPL with all debug flags enabled.
$ make
2013-10-17 01:09:39 -04:00
In the default option, when `make` command is called without arguments, it builds the binary and right after that dropped into the picrin interactive shell (REPL).
2013-10-20 08:44:31 -04:00
- install
As of now picrin does not provide a command automatically installs the binary. If you want to place picrin library and binary in a parmanent directory, please do it by hand.
2013-10-17 07:58:01 -04:00
## Requirement
picrin scheme depends on some external libraries to build the binary:
- bison
- yacc
- make
- gcc
- readline
The compilation is tested only on Mac OSX. I think (or hope) it'll be ok to compile and run on other operating systems such as Linux or Windows, but there's no guarantee :(
2013-10-17 01:09:39 -04:00
## Authors
Yuichi Nishiwaki (yuichi.nishiwaki at gmail.com)