Skip to content

Commit

Permalink
Merge pull request #406 from yamacir-kit/r7rs
Browse files Browse the repository at this point in the history
R7RS
  • Loading branch information
yamacir-kit authored Jul 21, 2022
2 parents 0c1bc0b + 2a9d91d commit c0db401
Show file tree
Hide file tree
Showing 35 changed files with 1,700 additions and 1,326 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ Subset of R7RS-small.
| [ 6](https://srfi.schemers.org/srfi-6/srfi-6.html) | Basic String Ports | [`(srfi 6)`](./basis/srfi-6.ss) <br> [`(scheme base)`](./basis/r7rs.ss) | R7RS 6.13 |
| [ 8](https://srfi.schemers.org/srfi-8/srfi-8.html) | receive: Binding to multiple values | [`(srfi 8)`](./basis/srfi-8.ss) | |
| [ 10](https://srfi.schemers.org/srfi-10/srfi-10.html) | #, external form | built-in | |
| [ 11](https://srfi.schemers.org/srfi-11/srfi-11.html) | Syntax for receiving multiple values | [`(srfi 11)`](./basis/srfi-11.ss) <br> [`(scheme base)`](./basis/r7rs.ss) | R7RS 4.2.2 |
| [ 23](https://srfi.schemers.org/srfi-23/srfi-23.html) | Error reporting mechanism | [`(srfi 23)`](./basis/srfi-23.ss) <br> [`(scheme base)`](./basis/r7rs.ss) | R7RS 6.11 |
| [ 30](https://srfi.schemers.org/srfi-30/srfi-30.html) | Nested Multi-line Comments | built-in | R7RS 2.2 |
| [ 34](https://srfi.schemers.org/srfi-34/srfi-34.html) | Exception Handling for Programs | [`(srfi 34)`](./basis/srfi-34.ss) <br> [`(scheme base)`](./basis/r7rs.ss) | R7RS 6.11 |
| [ 39](https://srfi.schemers.org/srfi-39/srfi-39.html) | Parameter objects | [`(srfi 39)`](./basis/srfi-39.ss) <br> [`(scheme base)`](./basis/r7rs.ss) | R7RS 4.2.6 |
| [ 45](https://srfi.schemers.org/srfi-45/srfi-45.html) | Primitives for Expressing Iterative Lazy Algorithms | [`(srfi 45)`](./basis/srfi-45.ss) | [#296](https://github.com/yamacir-kit/meevax/issues/296)
Expand Down Expand Up @@ -103,9 +105,9 @@ sudo rm -rf /usr/local/share/meevax

| Target Name | Description
|:-------------------|:--
| `all` (default) | Build shared-library `libmeevax.0.4.117.so` and executable `meevax`.
| `all` (default) | Build shared-library `libmeevax.0.4.166.so` and executable `meevax`.
| `test` | Test executable `meevax`.
| `package` | Generate debian package `meevax_0.4.117_amd64.deb`.
| `package` | Generate debian package `meevax_0.4.166_amd64.deb`.
| `install` | Copy files into `/usr/local` __(1)__.
| `install.deb` | `all` + `package` + `sudo apt install <meevax>.deb`
| `safe-install.deb` | `all` + `test` + `package` + `sudo apt install <meevax>.deb`
Expand All @@ -120,7 +122,7 @@ __(1)__ Meevax installed by `make install` cannot be uninstalled by the system's
## Usage

```
Meevax Lisp System, version 0.4.117
Meevax Lisp System, version 0.4.166
Usage: meevax [OPTION...] [FILE...]
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.4.117
0.4.166
23 changes: 11 additions & 12 deletions basis/r4rs-essential.ss
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
(meevax read)
(meevax string)
(meevax symbol)
(rename (meevax syntax) (call-with-current-continuation! call-with-current-continuation))
(rename (meevax syntax)
(call-with-current-continuation! call-with-current-continuation))
(meevax vector)
(meevax write)
(srfi 211 explicit-renaming))
Expand Down Expand Up @@ -40,15 +41,13 @@
open-output-file close-input-port close-output-port read read-char
peek-char eof-object? write display newline write-char load)

(begin (define (unspecified) (if #f #f))

(define (list . xs) xs)
(begin (define (list . xs) xs)

(define-syntax cond
(er-macro-transformer
(lambda (form rename compare)
(if (null? (cdr form))
(unspecified)
(if #f #f)
((lambda (clause)
(if (compare (rename 'else) (car clause))
(cons (rename 'begin) (cdr clause))
Expand Down Expand Up @@ -284,7 +283,7 @@
(else `(,(rename 'begin) ,@xs))))
(define (each-clause clauses)
(cond ((null? clauses)
(unspecified))
(if #f #f))
((compare (rename 'else) (caar clauses))
(body (cdar clauses)))
((and (pair? (caar clauses))
Expand Down Expand Up @@ -566,14 +565,14 @@
(current-input-port))))

(define (read-char . port)
(%read-char (if (pair? port)
(car port)
(current-input-port))))
(get-char! (if (pair? port)
(car port)
(current-input-port))))

(define (peek-char . port)
(%peek-char (if (pair? port)
(car port)
(current-input-port))))
(get-char (if (pair? port)
(car port)
(current-input-port))))

(define (write x . port)
(%write-simple x (if (pair? port)
Expand Down
12 changes: 4 additions & 8 deletions basis/r4rs.ss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(define-library (scheme r4rs)
(import (meevax inexact)
(only (meevax number) exact-integer? expt exact inexact ratio?)
(only (meevax port) read-ready? standard-input-port standard-output-port)
(only (meevax port) get-ready? standard-input-port standard-output-port)
(only (meevax string) string-copy)
(only (meevax syntax) define-syntax)
(only (meevax vector) vector-fill!)
Expand Down Expand Up @@ -119,10 +119,6 @@
(atan (imag-part z)
(real-part z)))

; (define exact->inexact inexact)
;
; (define inexact->exact exact)

(define (list-tail x k)
(let list-tail ((x x)
(k k))
Expand Down Expand Up @@ -166,6 +162,6 @@
(set! %current-output-port previous-output-port)))

(define (char-ready? . port)
(read-ready? (if (pair? port)
(car port)
(current-input-port))))))
(get-ready? (if (pair? port)
(car port)
(current-input-port))))))
4 changes: 2 additions & 2 deletions basis/r5rs.ss
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
(apply emergency-exit normally?))))

(define-library (scheme r5rs)
(import (meevax environment)
(meevax evaluate)
(import (only (meevax environment) environment)
(only (meevax evaluate) eval)
(only (meevax syntax) define-syntax let-syntax letrec-syntax)
(except (scheme r4rs) call-with-current-continuation)
(except (scheme r5rs continuation) exit)
Expand Down
Loading

0 comments on commit c0db401

Please sign in to comment.