Permalink
Browse files

Created a black hole package for the srfis

  • Loading branch information...
per-gron committed Nov 10, 2011
1 parent 7e82bd3 commit f260f0d798e3bf2217159b78886dda06cd1a22e2
Showing with 28 additions and 10,368 deletions.
  1. 0 {srfi → }/.gitignore
  2. +20 −16 LICENSE
  3. +0 −109 README.markdown
  4. 0 {srfi → }/_optionals.scm
  5. 0 {srfi → }/and-let.scm
  6. +0 −2 build.scm
  7. 0 {srfi → }/case-lambda.scm
  8. 0 {srfi → }/char-set.scm
  9. 0 {srfi → }/cond.scm
  10. 0 {srfi → }/exception-handling.scm
  11. 0 {srfi → }/hash-tables.scm
  12. 0 {srfi → }/let-values.scm
  13. 0 {srfi → }/lists.scm
  14. +8 −0 pkgfile
  15. 0 {srfi → }/sorting.scm
  16. 0 {srfi → }/specialize-procedures.scm
  17. +0 −132 src/blackhole.scm
  18. +0 −509 src/compile-load.scm
  19. +0 −542 src/core-forms.scm
  20. +0 −294 src/expr.scm
  21. +0 −211 src/extras.scm
  22. +0 −1,496 src/hygiene.scm
  23. +0 −138 src/lib.scm
  24. +0 −601 src/loaded-module.scm
  25. +0 −322 src/loader.scm
  26. +0 −265 src/location.scm
  27. +0 −130 src/module-info.scm
  28. +0 −527 src/module-macroexpansion.scm
  29. +0 −98 src/module-reference.scm
  30. +0 −135 src/namespace.scm
  31. +0 −922 src/packages.scm
  32. +0 −335 src/resolvers.scm
  33. +0 −76 src/syntactic-tower.scm
  34. +0 −325 src/syntax-rules.scm
  35. +0 −932 src/tree.scm
  36. +0 −571 src/util.scm
  37. 0 {srfi → }/strings.scm
  38. 0 {srfi → }/tests.scm
  39. +0 −4 tests/1/test.scm
  40. +0 −12 tests/1/test2.scm
  41. +0 −4 tests/2/test.scm
  42. +0 −8 tests/2/test2.scm
  43. +0 −71 tests/run.scm
  44. +0 −43 tests/srfi/and-let.scm
  45. +0 −34 tests/srfi/cond.scm
  46. +0 −44 tests/srfi/hash-tables.scm
  47. +0 −25 tests/srfi/let-values.scm
  48. +0 −47 tests/srfi/specialize-procedures.scm
  49. +0 −15 tests/srfi/tests.scm
  50. +0 −1,373 tests/units.scm
  51. 0 {srfi → }/time.scm
File renamed without changes.
View
36 LICENSE
@@ -1,19 +1,23 @@
-Copyright (c) 2008-2010 Per Eckerdal, Mikael More, Christian Jaeger
+Unless otherwise noted in the source files, they are released
+under the MIT license, as follows:
-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:
+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 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.
+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.
View
@@ -1,109 +0,0 @@
-# Black Hole
-
-Black Hole is an R5RS compatible module system for Gambit which allows
-you to easily import libraries into your code including macros, which
-previously has been tricky on Gambit. Conversely you can also export
-your own code and create your own libraries to fully modularise your
-development.
-
-
-# Installation
-
-Black Hole installs itself in the Gambit interpreter and compiler as a
-macro expander. The installation of Black Hole basically consists of
-downloading it, compiling it, and making sure it is `load`ed at the
-proper times. Compilation isn't necessary, and it can be loaded
-manually from the REPL by `load`ing "build.scm". This approach is
-merely for convenience:
-
-* Download Black Hole
-* Compile Black Hole by running `gsc build` from a terminal inside
- the Black Hole source directory.
-* Make a symbolic link called `bsc` that points to `gsc` and put it
- in your `PATH`.
-* Put this in your `~/.gambcini` file, changing `blackhole-path` to
- point to where Black Hole is installed:
-
- (let ((blackhole-path "~~lib/modules"))
- (and (equal? (path-strip-directory (car (command-line))) "bsc")
- (load (path-expand "build" blackhole-path))
- (begin
- (println "Loaded Black Hole."))))
-
-* You can now run Black Hole with the command `bsc`
-
-
-# Usage
-
-In Black Hole, a module corresponds directly to a `.scm` source code
-file. To create a new module, create a `.scm` file.
-
-Black Hole is designed to add as little extra syntax as possible from
-plain R5RS code. A simple R5RS .scm file without any external
-dependencies is without modification a valid Black Hole module.
-
-## Importing and exporting names
-
-By default, all defined functions, globals and macros are exported. To
-control that, place an `export` form at the top of the file, that
-enumerates the names that should be exported. For instance you could
-create a file named "a-module.scm" with the following contents:
-
- (export a-procedure a-number)
-
- (define secret-number 1)
- (define (a-procedure var) (+ secret-number var))
- (define a-number 5)
-
-For a module system to be useful, a module has to be able to use code
-from other modules. That is done with the `import` form. `import`
-takes one or more *module identifiers*. A module identifier can be
-several things, but the most common kind of module identifier is a
-symbol. `(import a-module)` will import the module in the file
-"a-module.scm".
-
-These paths are always relative to the directory where the module file
-is located (or the working directory if in the REPL).
-`(import ../dir/module)` imports the module that is found at
-"../dir/module.scm"
-
-## Compiling modules
-
-Modules are not compiled like plain Gambit with the `gsc` command;
-They are compiled from the REPL:
-
-* `(module-compile! 'test)` compiles the module found in "test.scm".
-* `(module-compile/deps! 'test)` compiles the module found in
- "test.scm" and all its dependencies.
-* `(module-compile-to-standalone "a.out" 'test)` compiles the module
- found in "test.scm" to a standalone executable "a.out"
-
-## Macros
-
-In essence, Black Hole is a macro expander. Black Hole extends Gambit
-with hygienic macros. It adds support for the special forms
-`define-syntax`, `let-syntax` and `letrec-syntax`. Currently, Black
-Hole supports macros through explicit renaming
-(`er-macro-transformer`), syntactic closures (`sc-macro-transformer`
-and `rsc-macro-transformer`) and R5RS `syntax-rules`.
-
-It also adds a macro expansion function, `expand-macro`. It can be
-used to inspect what is happening with the macro expansion:
-
- > (expand-macro '(let ((a 'hello)) a))
- (let ((1#a 'hello)) 1#a)
- >
-
-`define-macro` macros are supported, but beware that they might get
-special identifier objects instead of just symbols when combined with
-hygienic macros. Usage of the other forms of macros is strongly
-recommended.
-
-# More information / Contact
-
-Please drop me a line at *per dot eckerdal at gmail dot com* or use
-the Gambit mailing list if you have any questions.
-
-The [Black Hole page at the Gambit
-wiki](http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php/Black_Hole)
-might also be of interest.
File renamed without changes.
File renamed without changes.
View
@@ -1,2 +0,0 @@
-(##include "src/blackhole.scm")
-(apply-hooks!)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
View
@@ -0,0 +1,8 @@
+(package
+ (version v0.0.1)
+ (maintainer "Per Eckerdal <per dot eckerdal at gmail dot com>")
+ (author "Several")
+ (homepage "http://github.com/pereckerdal/srfi")
+ (description "A collection of SRFI implementations")
+ (keywords srfi util)
+ (license various))
File renamed without changes.
File renamed without changes.
View
@@ -1,132 +0,0 @@
-(##namespace ("bh#"))
-
-(##include "~~/lib/gambit#.scm")
-
-(declare (standard-bindings)
- (extended-bindings)
- #;(not proper-tail-calls) ;; Useful for debugging
- (block))
-
-(define *blackhole-work-dir* "~/.blackhole")
-
-(##include "tree.scm") ;; A functional weighted tree data structure
-(##include "util.scm") ;; Utility functions.
-(##include "expr.scm") ;; Library for handling Gambit
- ;; source objects
-(##include "syntactic-tower.scm") ;; Syntactic tower data structure
-(##include "hygiene.scm") ;; The hygiene system implementation
-(##include "core-forms.scm") ;; Core forms
-(##include "syntax-rules.scm") ;; The syntax-rules implementation
-(##include "resolvers.scm") ;; Module, import and export resolvers
-(##include "namespace.scm") ;; Namespace choice functionality
-(##include "compile-load.scm") ;; Utilities for compiling and loading
-(##include "module-reference.scm") ;; Module reference data structure
-(##include "module-info.scm") ;; Module info data structure
-(##include "loader.scm") ;; Loader data structure
-(##include "loaded-module.scm") ;; Loaded module data structure
-(##include "module-macroexpansion.scm") ;; The module system core
-(##include "extras.scm") ;; Some utilities, for instance
- ;; module-compile/deps!
-(##include "lib.scm") ;; The lib (fetching remote
- ;; modules) implementation
-(##include "packages.scm") ;; The packages implementation
-
-
-
-;;;; ---------- Hack for configuration ----------
-
-;; Variables declared here are used all over the place.
-
-;; Configuration directives
-(define *compiler-options* '())
-(define *compiler-cc-options* "")
-(define *compiler-ld-options-prelude* "")
-(define *compiler-ld-options* "")
-
-(define *srfi-directory*
- (path-expand "../srfi"
- (path-expand
- (path-directory
- (get-path)))))
-(define *std-directory* "~~lib/modules/std")
-(set! *module-resolvers*
- `((here ,@current-module-resolver)
- (black-hole ,@black-hole-module-resolver)
- (lib ,@lib-module-resolver)
- (std ,@(directory-module-resolver *std-directory*))
- (srfi ,@(directory-module-resolver *srfi-directory*))
- (pkg ,@package-module-resolver)))
-
-
-;; ---------- Add the hooks =) ----------
-
-(define (apply-hooks!)
- (let ((hook
- (lambda (src)
- (let ((ret (expr:deep-fixup
- (suspend-ns-table-changes
- (lambda ()
- (expand-macro src))))))
- ;; Useful when debugging
- ;; (pp (expr*:strip-locationinfo ret))
- ret))))
- (set! ##expand-source hook)
- (set! c#expand-source hook))
-
- (##vector-set!
- (##thread-repl-channel-get! (current-thread))
- 6
- (lambda (channel level depth)
- (with-exception-catcher
- (lambda (e)
- (print e))
- (lambda ()
- (let ((mod (environment-module-reference (*top-environment*))))
- (if mod
- (begin
- (print (loader-module-name (module-reference-loader mod)
- (module-reference-path mod)))
- (if (##fixnum.< 0 level)
- (print "/")))))))
- (##repl-channel-ports-read-command channel level depth))))
-
-(define (start-repl! #!key suppress-message)
- (apply-hooks!)
- (if (not suppress-message)
- (println "Gambit-C with Black Hole"))
- (##repl))
-
-
-
-
-(define (module-files-args)
- (if (null? (cdr (command-line)))
- '()
- (cddr (command-line))))
-
-(define (module-file-arg)
- (car (module-files-args)))
-
-(define (read-string str)
- (with-input-from-string str
- (lambda ()
- (read))))
-
-(define (module-reference-prettyprint ref)
- (println (module-reference-path ref)))
-
-#;(let ((command
- (if (null? (cdr (command-line)))
- 'repl
- (string->symbol (cadr (command-line))))))
- (case command
- ((repl)
- (start-repl!))
- ((dependencies)
- (for-each (lambda (module)
- (for-each module-reference-prettyprint
- (module-deps module)))
- (resolve-modules
- (map read-string (module-files-args)))))
- (else
- (error "Unknown command"))))
Oops, something went wrong.

0 comments on commit f260f0d

Please sign in to comment.