Commit bd5c3315 authored by Marco Antoniotti's avatar Marco Antoniotti

Initial commit

parents
This library is in the Public Domain.
(Of course, if you can see the library; and if you can, you'd better
have some bananas with you.)
Author: Marco "Rincewind" Antoniotti, 2015-2016
# OOK!
A Common Lisp compiler and decompiler for the programming language
[__OOK!__](http://esolangs.org/wiki/Ook!).
It is well known that orangutans grok Lisp.
<html>
<!DOCTYPE HTML PUBLIC
"-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<head>
<title>
Constant
+ooks+
</title>
<link rel="stylesheet" href="../helambdap.css" />
</head>
<body>
<h1>
<i>
Internal
Constant
</i>
<strong>
+ooks+
</strong>
</h1>
<h2>
Package:
</h2>
<p>
OOK
</p>
<h2>
Value:
</h2>
<p>
<code>
'(OOK. OOK? OOK!)
</code>
</p>
<h2>
Description:
</h2>
<p>
Need we say more?
</p>
</body>
</html>
<html>
<!DOCTYPE HTML PUBLIC
"-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<head>
<title>
Constant
monkey?!?
</title>
<link rel="stylesheet" href="../helambdap.css" />
</head>
<body>
<h1>
<i>
Constant
</i>
<strong>
monkey?!?
</strong>
</h1>
<h2>
Package:
</h2>
<p>
OOK
</p>
<h2>
Value:
</h2>
<p>
<code>
'MONKEY?!?
</code>
</p>
<h2>
Description:
</h2>
<p>
You are in trouble if you call him 'monkey'!
</p>
</body>
</html>
<head>
<title>
Ook!
:
FUNCTION
gently-ask-the-librarian
</title>
<link rel="stylesheet" href="../helambdap.css" />
</head>
<body>
<h1>
<i>
Function
</i>
<strong>
gently-ask-the-librarian
</strong>
</h1>
<h2>
Package:
</h2>
<p>
OOK
</p>
<h2>
Syntax:
</h2>
<div>
<p>
<pre>
<strong style="color: red">gently-ask-the-librarian</strong> <i>OOKS</i> <span style="color: blue">&OPTIONAL</span> <i>RUN</i> &rarr; <i>result</i></pre>
</p>
</div>
<h3>
Arguments and Values:
</h3>
<ul>
<li style="list-style-type: none">
<i>
<code>
OOKS
</code>
</i>
:
some 'ooks'.
</li>
<li style="list-style-type: none">
<i>
<code>
RUN
</code>
</i>
:
a generalized boolean, default is T.
</li>
<li style="list-style-type: none">
<i>
<code>
result
</code>
</i>
:
a compiled function taking no arguments.
</li>
</ul>
<h2>
Description:
</h2>
<p>
ACTUALLY, the main request for interpretation of OOKS.
</p>
<p>
Naturally, to be asked gently.
</p>
<p>
It compiles the OOKS and executes them if the optional RUN parameter is T;
it returns the compiled function that contains the OOKS. The function
can then be reused as needed.
</p>
<h2>
Examples:
</h2>
<pre>
cl-prompt&gt; (ook? #P"bottles.ook")</pre>
<h2>
See Also:
</h2>
<p>
OOK? OOK.
</p>
<h2>
Notes:
</h2>
<p>
The compiler (which eventually calls the <strong>CL</strong> <code>compile</code>
function) may take a long time. Whether this is due to the size of
the TAGBODY generated or whether the Librarian has run out of bananas
and went looking for them in the Unseen University kitchen, it is
unknown, but, surely, somewhat magical.
</p>
</body>
\ No newline at end of file
<head>
<title>
Ook!
:
FUNCTION
koo
</title>
<link rel="stylesheet" href="../helambdap.css" />
</head>
<body>
<h1>
<i>
Function
</i>
<strong>
koo
</strong>
</h1>
<h2>
Package:
</h2>
<p>
OOK
</p>
<h2>
Syntax:
</h2>
<div>
<p>
<pre>
<strong style="color: red">koo</strong> <i>OOKS</i> <span style="color: blue">&OPTIONAL</span> <i>LIBRARY-STREAM</i> &rarr; <i>result</i></pre>
</p>
</div>
<h3>
Arguments and Values:
</h3>
<ul style="list-style-type: none">
<li style="list-style-type: none">
<i>
<code>
OOKS
</code>
</i>
:
a
T
</li>
<li style="list-style-type: none">
<i>
<code>
LIBRARY-STREAM
</code>
</i>
:
a
T
</li>
<li style="list-style-type: none">
<i>
<code>
result
</code>
</i>
: a T.
</li>
</ul>
<h2>
Description:
</h2>
<p>
The Ook decompiler.
</p>
<p>
Takes the LAMBDA generated by the compiler and wirtes out the programs
in a format readable by an orangutan (or by a well fed and drunk
wizard, unless he is asleep, which will be the case most of the time
when well fed and drunk).
</p>
<p>
I am repeating this because KOO is called by OOK! (the decompiler) and
wizards have been known to require more than a repetition of whatever
it is said (especially during Faculty Meetings.)
</p>
<h2>
See Also:
</h2>
<p>
OOK!
</p>
</body>
\ No newline at end of file
<head>
<title>
Ook!
:
FUNCTION
make-library
</title>
<link rel="stylesheet" href="../helambdap.css" />
</head>
<body>
<h1>
<i>
Internal
Function
</i>
<strong>
make-library
</strong>
</h1>
<h2>
Package:
</h2>
<p>
OOK
</p>
<h2>
Syntax:
</h2>
<div>
<p>
<pre>
<strong style="color: red">make-library</strong> &rarr; <i>result</i></pre>
</p>
</div>
<h3>
Arguments and Values:
</h3>
<ul style="list-style-type: none">
<li style="list-style-type: none">
<i>
<code>
result
</code>
</i>
: a T.
</li>
</ul>
<h2>
Description:
</h2>
<p>
Creates the memory where the progr... sorry, the 'ooks', reside.
</p>
</body>
\ No newline at end of file
<head>
<title>
Ook!
:
FUNCTION
ook!
</title>
<link rel="stylesheet" href="../helambdap.css" />
</head>
<body>
<h1>
<i>
Function
</i>
<strong>
ook!
</strong>
</h1>
<h2>
Package:
</h2>
<p>
OOK
</p>
<h2>
Syntax:
</h2>
<div>
<p>
<pre>
<strong style="color: red">ook!</strong> <i>OOKS</i> <span style="color: blue">&OPTIONAL</span> <i>LIBRARY-STREAM</i> &rarr; <i>result</i></pre>
</p>
</div>
<h3>
Arguments and Values:
</h3>
<ul style="list-style-type: none">
<li style="list-style-type: none">
<i>
<code>
OOKS
</code>
</i>
:
a
T
</li>
<li style="list-style-type: none">
<i>
<code>
LIBRARY-STREAM
</code>
</i>
:
a
T
</li>
<li style="list-style-type: none">
<i>
<code>
result
</code>
</i>
: a T.
</li>
</ul>
<h2>
Description:
</h2>
<p>
The Ook decompiler.
</p>
<p>
Takes the LAMBDA generated by the compiler and wirtes out the programs
in a format readable by an orangutan (or by a well fed and drunk
wizard, unless he is asleep, which will be the case most of the time
when well fed and drunk).
</p>
<h2>
See Also:
</h2>
<p>
KOO
</p>
</body>
\ No newline at end of file
<head>
<title>
Ook!
:
FUNCTION
ook?
</title>
<link rel="stylesheet" href="../helambdap.css" />
</head>
<body>
<h1>
<i>
Function
</i>
<strong>
ook?
</strong>
</h1>
<h2>
Package:
</h2>
<p>
OOK
</p>
<h2>
Syntax:
</h2>
<div>
<p>
<pre>
<strong style="color: red">ook?</strong> <i>OOKS</i> &rarr; <i>result</i></pre>
</p>
</div>
<h3>
Arguments and Values:
</h3>
<ul style="list-style-type: none">
<li style="list-style-type: none">
<i>
<code>
OOKS
</code>
</i>
:
a
T
</li>
<li style="list-style-type: none">
<i>
<code>
result
</code>
</i>
: a T.
</li>
</ul>
<h2>
Description:
</h2>
<p>
The main request for interpretation of OOKS.
</p>
<p>
Or to peel a banana. Works as well. It is actually a wrapper for
gently asking the Librarian for some information.
</p>
<h2>
See Also:
</h2>
<p>
GENTLY-ASK-THE-LIBRARIAN
</p>
</body>
\ No newline at end of file
<head>
<title>
Ook!
:
Generic Function
ook.
</title>
<link rel="stylesheet" href="../helambdap.css" />
</head>
<body>
<h1>
<i>
Generic Function
</i>
<strong>
ook.
</strong>
</h1>
<h2>
Package:
</h2>
<p>
OOK
</p>
<h2>
Syntax:
</h2>
<p>
<pre>
<span style="color: red"><strong>ook.</strong></span> <i>OOKS</i>
&rarr; <i>result</i></pre>
</p>
<h3>
Arguments and Values:
</h3>
<ul>
<li style="list-style-type: none">
<i>
<code>
OOKS
</code>
</i>
:
see the methods' descriptions.
</li>
<li style="list-style-type: none">
<i>
<code>
result
</code>
</i>
:
a lambda-expression taking no arguments.
</li>
</ul>
<h2>
Description:
</h2>
<p>
The OOK compiler entry point.
</p>
<p>
This generic function just wraps the actual compiler, which expects a
list of - you guessed it - 'ooks'.
</p>
<div>
<h2>
Known Documented Methods:
</h2>
<ol>
<li>
<p>
<pre>
<strong>ook.</strong> <i>&lt;STRING&gt;</i> &rarr; <i>result</i></pre>
</p>
<p>
<p>
Dispatches on a pathname containing the OOKS.
</p>
</p>
</li>
<li>
<p>
<pre>
<strong>ook.</strong> <i>&lt;PATHNAME&gt;</i> &rarr; <i>result</i></pre>
</p>
<p>
<p>
The pathname containing the OOKS is opened and its content read.
</p>
</p>
</li>
<li>
<p>
<pre>
<strong>ook.</strong> <i>&lt;STREAM&gt;</i> &rarr; <i>result</i></pre>
</p>
<p>
<p>
Compiles the OOKS from the (banana) STREAM.
</p>
</p>
</li>
<li>
<p>
<pre>
<strong>ook.</strong> <i>&lt;LIST&gt;</i> &rarr; <i>result</i></pre>
</p>
<p>
<p>
OOKS is a list of OOKs to be compiled pair by pair.
</p>
<p>
The result is a LAMBDA of no arguments that contains the compiled
program (essentially a giant TAGBODY).
</p>
</p>
</li>
<li>
<p>
<pre>
<strong>ook.</strong> <i>&lt;T&gt;</i> &rarr; <i>result</i></pre>
</p>
<p>
<p>
You are in trouble! This method says 'monkey?!?.
</p>
</p>
</li>
</ol>
</div>
</body>
\ No newline at end of file
<head>
<title>
Ook!
:
METHOD
ook.
</title>
<link rel="stylesheet" href="../helambdap.css" />
</head>
<body>
<h1>
<i>
Method
</i>
<strong>
ook.
</strong>
</h1>
<h2>
Package:
</h2>
<p>
OOK
</p>
<h2>
Syntax:
</h2>
<div>
<p>
<pre>
<strong style="color: red">ook.</strong> <i>OOKS</i> &rarr; <i>result</i></pre>
</p>
</div>
<h3>
Arguments and Values:
</h3>
<ul style="list-style-type: none">
<li style="list-style-type: none">
<i>
<code>
OOKS
</code>
</i>
:
a
T
</li>
<li style="list-style-type: none">
<i>
<code>
result
</code>
</i>
: a T.
</li>
</ul>
<h2>
Description:
</h2>
<p>
You are in trouble! This method says 'monkey?!?.
</p>
</body>
\ No newline at end of file
<!-- Package-OOK-list.html -->
<!DOCTYPE HTML PUBLIC
"-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>
OOK Package List
</title>
<link rel="stylesheet" href="../helambdap.css" />
<style>
.helambdap_navmap li {
display: inline;
}
</style>
</head>
<body>
<h3>
Package interface