2022-08-02 11:08:11 -04:00
|
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
|
|
<head>
|
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
|
|
<title>The portable R6RS library and syntax-case system</title>
|
|
|
|
<link href="style.css" rel="stylesheet" type="text/css" />
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
<div id="mainPan">
|
|
|
|
<div id="topPan">
|
|
|
|
<div id="topcontactPan">
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div id="headerPan">
|
|
|
|
<ul class="leftmenu">
|
2022-08-02 11:14:19 -04:00
|
|
|
<li><a href="../../ikarus/">Ikarus</a></li>
|
2022-08-02 11:08:11 -04:00
|
|
|
<li class="Solutions">psyntax</li>
|
|
|
|
<!--
|
|
|
|
<li><a href="#">About me</a></li>
|
|
|
|
<li><a href="#">Downloads</a></li>
|
|
|
|
<li><a href="#">Roadmap</a></li>
|
|
|
|
<li><a href="#">Development</a></li>
|
|
|
|
<li><a href="#">Changes</a></li>
|
|
|
|
<li><a href="#">License</a></li>
|
|
|
|
-->
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
<div id="bodyPan">
|
|
|
|
<div id="leftPan">
|
|
|
|
<h2>psyntax</h2>
|
|
|
|
<ul>
|
|
|
|
<li><a href="#about"><span>About psyntax</span></a></li>
|
|
|
|
<li><a href="#downloads"><span>Downloads</span></a></li>
|
|
|
|
<li><a href="#development"><span>Development</span></a></li>
|
|
|
|
<li><a href="#usage"><span>Basic Usage</span></a></li>
|
|
|
|
<li><a href="#structure"><span>Structure</span></a></li>
|
|
|
|
<li><a href="#nonr6"><span>Non-R6RS Req.</span></a></li>
|
|
|
|
<li><a href="#changes"><span>Changes</span></a></li>
|
|
|
|
<li><a href="#license"><span>License</span></a></li>
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div id="rightPan">
|
|
|
|
|
|
|
|
<h1 id="about">About psyntax</h1>
|
|
|
|
|
|
|
|
<p>This page contains a reference implementation of the
|
|
|
|
proposed implicitly-phased libraries for R6RS. The
|
|
|
|
implementation is portable, depending only on a small set of
|
|
|
|
common primitives that are readily available in many
|
|
|
|
implementations. The implementation is also written as a
|
|
|
|
collection of R6RS libraries in order to take advantage of the
|
|
|
|
key R6RS libraries benefit: to easily isolate
|
|
|
|
implementation-dependent extensions in a mechanical way.</p>
|
|
|
|
|
|
|
|
<h1>Supported Platforms</h1>
|
|
|
|
|
|
|
|
<p> The system is known to load and bootstrap itself properly
|
|
|
|
on the following Scheme implementations: </p>
|
|
|
|
|
|
|
|
<ul class="services">
|
|
|
|
<li> Bigloo 3.0b</li>
|
|
|
|
<li> Chez Scheme 7.2</li>
|
|
|
|
<li> Chicken 2.710</li>
|
|
|
|
<li> Gambit 4.0.1</li>
|
|
|
|
<li> Gauche 0.8.11</li>
|
|
|
|
<li> Ikarus (Build 2007-09-24)</li>
|
|
|
|
<li> Larceny 0.93</li>
|
|
|
|
<li> MIT-Scheme 7.7.90.+</li>
|
|
|
|
<li> MzScheme v371 [3m]</li>
|
|
|
|
<li> Petite Chez Scheme 7.2</li>
|
|
|
|
<li> Scheme48 1.7</li>
|
|
|
|
<li> SISC (1.16.6)</li>
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
<p> For every supported platform, there is a
|
|
|
|
"<tt><impl>.r6rs.ss</tt>"
|
|
|
|
file containing a small number of compatibility definitions
|
|
|
|
that allow loading the expanded system (e.g. <tt>psyntax.pp</tt>)
|
|
|
|
properly. </p>
|
|
|
|
|
|
|
|
<p> To port to another system, start by loading "<tt>psyntax.pp</tt>".
|
|
|
|
If you get an error about undefined variables, look for how
|
|
|
|
these variables are defined in the other <tt>*.r6rs.ss</tt> files and
|
|
|
|
port them over to your implementation. It would help to start
|
|
|
|
with a supported implementation that's most familiar to you.
|
|
|
|
Please let me know (email: aghuloum at cs.indiana.edu) if you
|
|
|
|
get the system ported to another platform. </p>
|
|
|
|
|
|
|
|
<h1 id="downloads">Downloads</h1>
|
|
|
|
|
|
|
|
<p>
|
|
|
|
Download
|
|
|
|
<a href="psyntax-r6rs-rev4.tgz"><tt>psyntax-r6rs-rev4.tgz</tt></a>
|
|
|
|
(released Oct 27, 2007).
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<p>Older versions</p>
|
|
|
|
<ul>
|
|
|
|
<li><a href="psyntax-r6rs-rev1.tgz"><tt>psyntax-r6rs-rev1.tgz</tt></a>
|
|
|
|
released on Oct 3, 2007.</li>
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
<h1 id="development">Development</h1>
|
|
|
|
|
|
|
|
|
|
|
|
<p> Development of the portable syntax-case system is
|
|
|
|
continuing. For the latest snapshot, and to submit bug reports
|
|
|
|
and feature requests, please visit:
|
|
|
|
<a href="https://launchpad.net/r6rs-libraries/">Launchpad's
|
|
|
|
r6rs-libraries</a> project.</p>
|
|
|
|
|
|
|
|
<p>Access to the latest development snapshot is through
|
|
|
|
<a href="http://bazaar-vcs.org/">Bazaar Version Control</a>.
|
|
|
|
If you have <tt>bzr</tt>, you get the software by typing the
|
|
|
|
following command at your terminal:
|
|
|
|
</p>
|
|
|
|
<pre>
|
|
|
|
$ bzr branch http://bazaar.launchpad.net/~aghuloum/r6rs-libraries/r6rs-libraries.dev
|
|
|
|
</pre>
|
|
|
|
|
|
|
|
|
|
|
|
<h1 id="usage">Basic Usage</h1>
|
|
|
|
|
|
|
|
|
|
|
|
<p>To run an r6rs script on your system, you'll need the
|
|
|
|
following files:</p>
|
|
|
|
|
|
|
|
<ul>
|
|
|
|
<li> The script you want to run (say <tt>hello-world.ss</tt>).</li>
|
|
|
|
<li> The <tt>host.r6rs.ss</tt> file for your platform.</li>
|
|
|
|
<li> The <tt>pre-built/psyntax-host.pp</tt> file.</li>
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
<p>For example, we may have a script that looks like:</p>
|
|
|
|
|
|
|
|
<pre>
|
|
|
|
$ cat hello-world.ss
|
|
|
|
(import (rnrs io simple))
|
|
|
|
(display "Hello World\n")
|
|
|
|
</pre>
|
|
|
|
|
|
|
|
|
|
|
|
<p>We copy our host's <tt>pre-built/psyntax-host.pp</tt> to
|
|
|
|
<tt>psyntax.pp</tt>
|
|
|
|
For Petite Chez Scheme, we'd do:</p>
|
|
|
|
|
|
|
|
<pre>
|
|
|
|
$ cp pre-built/psyntax-petite.pp .
|
|
|
|
</pre>
|
|
|
|
|
|
|
|
|
|
|
|
<p>Run your implementation's <tt>r6rs.ss</tt> file passing the
|
|
|
|
script name as an extra argument. For example, under petite,
|
|
|
|
we do:</p>
|
|
|
|
|
|
|
|
<pre>
|
|
|
|
$ petite --script petite.r6rs.ss hello-world.ss
|
|
|
|
r6rs psyntax ready
|
|
|
|
Hello World
|
|
|
|
</pre>
|
|
|
|
|
|
|
|
|
|
|
|
<p> If you want to write a library, say <tt>(my-library)</tt> as:</p>
|
|
|
|
|
|
|
|
<pre>
|
|
|
|
$ cat my-library.ss
|
|
|
|
(library (my-library)
|
|
|
|
(export print-hello)
|
|
|
|
(import (rnrs))
|
|
|
|
(define (print-hello)
|
|
|
|
(display "Hello World\n")))
|
|
|
|
</pre>
|
|
|
|
|
|
|
|
|
|
|
|
<p>And then write your <tt>hello-world.ss</tt> script as:</p>
|
|
|
|
|
|
|
|
<pre>
|
|
|
|
$ cat hello-world.ss
|
|
|
|
(import (my-library))
|
|
|
|
(print-hello)
|
|
|
|
</pre>
|
|
|
|
|
|
|
|
|
|
|
|
<p>Then, you can run it as before:</p>
|
|
|
|
|
|
|
|
<pre>
|
|
|
|
$ petite --script petite.r6rs.ss hello-world.ss
|
|
|
|
r6rs psyntax ready
|
|
|
|
Hello World
|
|
|
|
</pre>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<p>The library system takes care of mapping the library names
|
|
|
|
that you import to file names via a primitive simple
|
|
|
|
mapping:</p>
|
|
|
|
|
|
|
|
<pre>
|
|
|
|
(foo) => ./foo.ss
|
|
|
|
(foo bar) => ./foo/bar.ss
|
|
|
|
...
|
|
|
|
</pre>
|
|
|
|
|
|
|
|
|
|
|
|
<p> To avoid any problems now, stick with names that contain
|
|
|
|
characters in <tt>[a..z]</tt>, <tt>[A..Z]</tt>,
|
|
|
|
<tt>[0..9]</tt>, "<tt>-</tt>", "<tt>_</tt>", "<tt>~</tt>", and
|
|
|
|
"<tt>.</tt>". If you have ideas about a general
|
|
|
|
library-name->file-name mapping that you'd like to share,
|
|
|
|
please do email me.</p>
|
|
|
|
|
|
|
|
|
|
|
|
<p> That's pretty much it as far as basic usage is concerned.
|
|
|
|
Let me know if you have any problems.</p>
|
|
|
|
|
|
|
|
<h1 id="structure">Structure of the system</h1>
|
|
|
|
|
|
|
|
<ul>
|
|
|
|
<li><tt>Makefile</tt> Used to build the system under all supported
|
|
|
|
platforms.</li>
|
|
|
|
|
|
|
|
<li><tt>README.txt</tt> The file you're reading right now.</li>
|
|
|
|
|
|
|
|
<li><tt>psyntax-buildscript.ss</tt>
|
|
|
|
An r6rs script that's used to bootstrap the whole system.</li>
|
|
|
|
|
|
|
|
<li><tt>*.r6rs.ss</tt>
|
|
|
|
Compatibility files for supported platforms with the exception of
|
|
|
|
<tt>kawa.r6rs.ss</tt> which is not working yet.</li>
|
|
|
|
|
|
|
|
<li><tt>pre-built/*.pp</tt>
|
|
|
|
Pre-built expanded files for the supported platforms.</li>
|
|
|
|
|
|
|
|
<li><tt>session-id</tt>
|
|
|
|
Used by gensym to generate unique ids across sessions.</li>
|
|
|
|
|
|
|
|
<li><tt>examples hello-world.ss</tt>
|
|
|
|
Example scripts.</li>
|
|
|
|
|
|
|
|
|
|
|
|
<li><tt>psyntax/internal.ss</tt> <tt>(psyntax internal)</tt><br/>
|
|
|
|
Contains definitions of some internal procedures that are used by
|
|
|
|
the system but may need to be modified to get optimal performance
|
|
|
|
and usability on any platform. It is currently written as a
|
|
|
|
common-denominator of all supported platforms.</li>
|
|
|
|
|
|
|
|
<li><tt>psyntax/builders.ss</tt>
|
|
|
|
<tt>(psyntax builders)</tt> <br/>
|
|
|
|
Exports procedures/macros that are used by the expander to build
|
|
|
|
the output expression. For example, build-letrec is used to build
|
|
|
|
letrec expressions. Implementations with tight integration may
|
|
|
|
replace the builders with constructors of compiler-internal data
|
|
|
|
structures.</li>
|
|
|
|
|
|
|
|
<li><tt>psyntax/expander.ss</tt>
|
|
|
|
<tt>(psyntax expander)</tt><br/>
|
|
|
|
The core of the expander.</li>
|
|
|
|
|
|
|
|
<li><tt>psyntax/library-manager.ss</tt>
|
|
|
|
<tt>(psyntax library-manager)</tt><br/>
|
|
|
|
The library manager keeps track of what libraries are installed
|
|
|
|
and available on the system. It takes care of visiting/invoking
|
|
|
|
such libraries as well as loading them from source files. </li>
|
|
|
|
|
|
|
|
<li><tt>psyntax/config.ss</tt>
|
|
|
|
<tt>(psyntax config)</tt><br/>
|
|
|
|
This is a compile-time configuration file for determining what
|
|
|
|
forms the implementation supports (e.g. is case-lambda supported
|
|
|
|
or should it be expanded). The provided configuration is one that
|
|
|
|
works for all implementation (common denominator).</li>
|
|
|
|
|
|
|
|
<li><tt>psyntax/compat.ss</tt>
|
|
|
|
<tt>(psyntax compat)</tt><br/>
|
|
|
|
This is a compatibility file for some non-r6rs forms that are used
|
|
|
|
in other libraries but can be implemented portably in terms of
|
|
|
|
other r6rs features. make-parameter, parameterize, and
|
|
|
|
define-record.</li>
|
|
|
|
|
|
|
|
<li><tt>psyntax/main.ss</tt>
|
|
|
|
<tt>(psyntax main)</tt><br/>
|
|
|
|
This library is the main entry point to the r6rs world. It
|
|
|
|
prints a greeting message and processes the file given in the
|
|
|
|
command line argument as an r6rs-script.</li>
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
<h1 id="nonr6">Non-R6RS requirements</h1>
|
|
|
|
|
|
|
|
<p> <tt>void</tt>: The procedure void is used in the output of the
|
|
|
|
expander when we don't care about a value (e.g. to provide the
|
|
|
|
initial values for the <tt>letrec*</tt>/internal-defines). A call
|
|
|
|
to void should not signal any errors. <tt>(define (void) (if #f
|
|
|
|
#f))</tt> suffices for this purpose.</p>
|
|
|
|
|
|
|
|
|
|
|
|
<p><tt>pretty-print</tt>: The procedure pretty-print should take
|
|
|
|
one or two values: an expression (code) to be printed and,
|
|
|
|
optionally, an output port. It should pretty-print the code to that
|
|
|
|
port (or the current-output-port if a port is not provided.
|
|
|
|
Implementations with no pretty printer can <tt>(define pretty-print
|
|
|
|
write)</tt> for this purpose but the output won't be very
|
|
|
|
readable.</p>
|
|
|
|
|
|
|
|
<p><tt>eval-core</tt>: This procedure should take a core s-expression and
|
|
|
|
evaluate it in a "top-level" environment. R5RS implementations can
|
|
|
|
define it as</p>
|
|
|
|
<pre>
|
|
|
|
(define (eval-core x) (eval x (interaction-environment)))
|
|
|
|
</pre>
|
|
|
|
|
|
|
|
|
|
|
|
<p><tt>gensym</tt>: The procedure gensym should create a globally unique symbol
|
|
|
|
with read/write invariance. It is used to create unique locations
|
|
|
|
for exported identifiers, unique names for lexical variables, and
|
|
|
|
unique labels in the expand-time environment. Of the supported
|
|
|
|
Scheme implementations, only Chez Scheme and Ikarus provide a usable
|
|
|
|
gensym implementation for this purpose; yet their printed
|
|
|
|
represenation of gensyms are not portable (cannot be read by the
|
|
|
|
other R5RS implementations). For this, we provide a gensym
|
|
|
|
implementation that's semi portable but relies on an external state
|
|
|
|
(session-id file) to ensure that the sequence of symbols generated
|
|
|
|
are unique across sessions. Gensym takes an optional argument that
|
|
|
|
is either a string or a symbol that can be used to correlate the
|
|
|
|
source name of the identifier with its unique name. The output of
|
|
|
|
our implementation of gensym looks like</p>
|
|
|
|
<pre>
|
|
|
|
<name>$<session-id>$<gensym-id>
|
|
|
|
</pre>
|
|
|
|
where both session-id and gensym-id are nonnegative integers.
|
|
|
|
|
|
|
|
<p><tt>symbol-value</tt>: This procedure takes a symbol
|
|
|
|
(typically a gensym) and returns the value associated with it
|
|
|
|
in the global environment. The symbol is guaranteed to be
|
|
|
|
initialized either via a global <tt>define</tt> or via
|
|
|
|
<tt>set-symbol-value!</tt> (below).</p>
|
|
|
|
|
|
|
|
<p><tt>set-symbol-value!</tt>: This procedure takes a symbol
|
|
|
|
(typically a gensym) and a value and associates the value with
|
|
|
|
the symbol in the global environment (in a way that eval-core
|
|
|
|
can properly see it).</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<h1 id="changes">Changes</h1>
|
|
|
|
|
|
|
|
<ul>
|
|
|
|
<li><p>Oct 27, 2007:
|
|
|
|
All of R6RS core syntactic forms are now supported by the
|
|
|
|
expander including <tt>define-record-type</tt>,
|
|
|
|
<tt>record-type-descriptor</tt>,
|
|
|
|
<tt>record-constructor-descriptor</tt>,
|
|
|
|
<tt>define-condition-type</tt>, <tt>define-enumeration</tt>,
|
|
|
|
and <tt>guard</tt>.
|
|
|
|
The expander now parses and enforces
|
|
|
|
version and subversion requirements for imported libraries.
|
|
|
|
The initial library set have proper version names,
|
|
|
|
<tt>(6)</tt>.
|
|
|
|
</p></li>
|
|
|
|
|
|
|
|
<li><p>Oct 3, 2007: Initial release (at ICFP 2007).
|
|
|
|
Implements most of the core functionality of R6RS including
|
|
|
|
the expander and the library manager.</p> </li>
|
|
|
|
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
<h1 id="license">License</h1>
|
|
|
|
|
|
|
|
<p>The following license applies to all of the distributed
|
|
|
|
psyntax files: </p>
|
|
|
|
|
|
|
|
<pre>
|
|
|
|
Copyright (c) 2006, 2007 Abdulaziz Ghuloum and Kent Dybvig
|
|
|
|
|
|
|
|
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. </pre>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div id="footermainPan">
|
|
|
|
<div id="footerPan">
|
|
|
|
<ul>
|
2022-08-02 11:14:19 -04:00
|
|
|
<li><a href="../../ikarus/">Ikarus</a>| </li>
|
2022-08-02 11:08:11 -04:00
|
|
|
<li><a href="#about">psyntax</a></li>
|
|
|
|
</ul>
|
|
|
|
<div id="footerPanhtml"><a href="http://validator.w3.org/check?uri=referer" target="_blank">XHTML</a></div>
|
|
|
|
<div id="footerPancss"><a href="http://jigsaw.w3.org/css-validator/check/referer" target="_blank">css</a></div>
|
|
|
|
<ul class="templateworld">
|
|
|
|
<li>original design by:</li>
|
|
|
|
<li><a href="http://www.templateworld.com" target="_blank">Template World</a></li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</body>
|
|
|
|
</html>
|