diff --git a/docs/codox/beowulf.bootstrap.html b/docs/codox/beowulf.bootstrap.html index 4827d95..200389e 100644 --- a/docs/codox/beowulf.bootstrap.html +++ b/docs/codox/beowulf.bootstrap.html @@ -1,6 +1,6 @@ -beowulf.bootstrap documentation

beowulf.bootstrap

Lisp as defined in Chapter 1 (pages 1-14) of the Lisp 1.5 Programmer's Manual; that is to say, a very simple Lisp language, which should, I believe, be sufficient in conjunction with the functions provided by beowulf.host, be sufficient to bootstrap the full Lisp 1.5 interpreter..

+beowulf.bootstrap documentation

beowulf.bootstrap

Lisp as defined in Chapter 1 (pages 1-14) of the Lisp 1.5 Programmer's Manual; that is to say, a very simple Lisp language, which should, I believe, be sufficient in conjunction with the functions provided by beowulf.host, be sufficient to bootstrap the full Lisp 1.5 interpreter..

The convention is adopted that functions in this file with names in ALLUPPERCASE are Lisp 1.5 functions (although written in Clojure) and that therefore all arguments must be numbers, symbols or beowulf.cons_cell.ConsCell objects.

APPEND

(APPEND x y)

Append the the elements of y to the elements of x.

All args are assumed to be beowulf.cons-cell/ConsCell objects. See page 11 of the Lisp 1.5 Programmers Manual.

APPLY

(APPLY function args environment depth)

Apply this function to these arguments in this environment and return the result.

For bootstrapping, at least, a version of APPLY written in Clojure. All args are assumed to be symbols or beowulf.cons-cell/ConsCell objects. See page 13 of the Lisp 1.5 Programmers Manual.

ASSOC

(ASSOC x a)

If a is an association list such as the one formed by PAIRLIS in the above example, then assoc will produce the first pair whose first term is x. Thus it is a table searching function.

diff --git a/docs/codox/beowulf.cons-cell.html b/docs/codox/beowulf.cons-cell.html index d58fe66..0866d70 100644 --- a/docs/codox/beowulf.cons-cell.html +++ b/docs/codox/beowulf.cons-cell.html @@ -1,3 +1,3 @@ -beowulf.cons-cell documentation

beowulf.cons-cell

The fundamental cons cell on which all Lisp structures are built. Lisp 1.5 lists do not necessarily have a sequence as their CDR, and must have both CAR and CDR mutable, so cannot be implemented on top of Clojure lists.

CAR

(CAR x)

Return the item indicated by the first pointer of a pair. NIL is treated specially: the CAR of NIL is NIL.

CDR

(CDR x)

Return the item indicated by the second pointer of a pair. NIL is treated specially: the CDR of NIL is NIL.

CONS

(CONS car cdr)

Construct a new instance of cons cell with this car and cdr.

cons-cell?

(cons-cell? o)

Is this object o a beowulf cons-cell?

F

The canonical false value - different from NIL, which is not canonically false in Lisp 1.5.

LIST

(LIST & args)

TODO: write docs

make-beowulf-list

(make-beowulf-list x)

Construct a linked list of cons cells with the same content as the sequence x.

make-cons-cell

(make-cons-cell car cdr)

Construct a new instance of cons cell with this car and cdr.

MutableSequence

protocol

Like a sequence, but mutable.

members

getCar

(getCar this)

Return the first element of this sequence.

getCdr

(getCdr this)

like more, q.v., but returns List NIL not Clojure nil when empty.

getUid

(getUid this)

Returns a unique identifier for this object

rplaca

(rplaca this value)

replace the first element of this sequence with this value

rplacd

(rplacd this value)

replace the rest (but-first; cdr) of this sequence with this value

pretty-print

(pretty-print cell)(pretty-print cell width level)

This isn’t the world’s best pretty printer but it sort of works.

T

The canonical true value.

\ No newline at end of file +beowulf.cons-cell documentation

beowulf.cons-cell

The fundamental cons cell on which all Lisp structures are built. Lisp 1.5 lists do not necessarily have a sequence as their CDR, and must have both CAR and CDR mutable, so cannot be implemented on top of Clojure lists.

CAR

(CAR x)

Return the item indicated by the first pointer of a pair. NIL is treated specially: the CAR of NIL is NIL.

CDR

(CDR x)

Return the item indicated by the second pointer of a pair. NIL is treated specially: the CDR of NIL is NIL.

CONS

(CONS car cdr)

Construct a new instance of cons cell with this car and cdr.

cons-cell?

(cons-cell? o)

Is this object o a beowulf cons-cell?

F

The canonical false value - different from NIL, which is not canonically false in Lisp 1.5.

LIST

(LIST & args)

TODO: write docs

make-beowulf-list

(make-beowulf-list x)

Construct a linked list of cons cells with the same content as the sequence x.

make-cons-cell

(make-cons-cell car cdr)

Construct a new instance of cons cell with this car and cdr.

MutableSequence

protocol

Like a sequence, but mutable.

members

getCar

(getCar this)

Return the first element of this sequence.

getCdr

(getCdr this)

like more, q.v., but returns List NIL not Clojure nil when empty.

getUid

(getUid this)

Returns a unique identifier for this object

rplaca

(rplaca this value)

replace the first element of this sequence with this value

rplacd

(rplacd this value)

replace the rest (but-first; cdr) of this sequence with this value

pretty-print

(pretty-print cell)(pretty-print cell width level)

This isn’t the world’s best pretty printer but it sort of works.

T

The canonical true value.

\ No newline at end of file diff --git a/docs/codox/beowulf.core.html b/docs/codox/beowulf.core.html index 37468f3..cce0b6b 100644 --- a/docs/codox/beowulf.core.html +++ b/docs/codox/beowulf.core.html @@ -1,3 +1,3 @@ -beowulf.core documentation

beowulf.core

Essentially, the -main function and the bootstrap read-eval-print loop.

-main

(-main & opts)

Parse options, print the banner, read the init file if any, and enter the read/eval/print loop.

cli-options

TODO: write docs

repl

(repl prompt)

Read/eval/print loop.

stop-word

TODO: write docs

\ No newline at end of file +beowulf.core documentation

beowulf.core

Essentially, the -main function and the bootstrap read-eval-print loop.

-main

(-main & opts)

Parse options, print the banner, read the init file if any, and enter the read/eval/print loop.

cli-options

TODO: write docs

repl

(repl prompt)

Read/eval/print loop.

stop-word

TODO: write docs

\ No newline at end of file diff --git a/docs/codox/beowulf.gendoc.html b/docs/codox/beowulf.gendoc.html index fc240b4..6d9ff88 100644 --- a/docs/codox/beowulf.gendoc.html +++ b/docs/codox/beowulf.gendoc.html @@ -1,3 +1,3 @@ -beowulf.gendoc documentation

beowulf.gendoc

TODO: write docs

find-documentation

(find-documentation entry)

TODO: write docs

gen-doc-table

(gen-doc-table)

TODO: write docs

host-functions

Functions which we can infer are written in Clojure.

infer-signature

(infer-signature entry)

TODO: write docs

infer-type

(infer-type entry)

TODO: write docs

\ No newline at end of file +beowulf.gendoc documentation

beowulf.gendoc

TODO: write docs

find-documentation

(find-documentation entry)

TODO: write docs

gen-doc-table

(gen-doc-table)

TODO: write docs

host-functions

Functions which we can infer are written in Clojure.

infer-signature

(infer-signature entry)

TODO: write docs

infer-type

(infer-type entry)

TODO: write docs

\ No newline at end of file diff --git a/docs/codox/beowulf.host.html b/docs/codox/beowulf.host.html index 11882b0..d7329e9 100644 --- a/docs/codox/beowulf.host.html +++ b/docs/codox/beowulf.host.html @@ -1,4 +1,4 @@ -beowulf.host documentation

beowulf.host

provides Lisp 1.5 functions which can’t be (or can’t efficiently be) implemented in Lisp 1.5, which therefore need to be implemented in the host language, in this case Clojure.

ADD1

(ADD1 x)

TODO: write docs

AND

(AND & args)

T if and only if none of my args evaluate to either F or NIL, else F.

+beowulf.host documentation

beowulf.host

provides Lisp 1.5 functions which can’t be (or can’t efficiently be) implemented in Lisp 1.5, which therefore need to be implemented in the host language, in this case Clojure.

ADD1

(ADD1 x)

TODO: write docs

AND

(AND & args)

T if and only if none of my args evaluate to either F or NIL, else F.

In beowulf.host principally because I don’t yet feel confident to define varargs functions in Lisp.

DIFFERENCE

(DIFFERENCE x y)

TODO: write docs

ERROR

(ERROR & args)

Throw an error

FIXP

(FIXP x)

TODO: write docs

GENSYM

(GENSYM)

Generate a unique symbol.

GREATERP

(GREATERP x y)

TODO: write docs

LESSP

(LESSP x y)

TODO: write docs

NUMBERP

(NUMBERP x)

TODO: write docs

PLUS

(PLUS & args)

TODO: write docs

QUOTIENT

(QUOTIENT x y)

I’m not certain from the documentation whether Lisp 1.5 QUOTIENT returned the integer part of the quotient, or a realnum representing the whole quotient. I am for now implementing the latter.

REMAINDER

(REMAINDER x y)

TODO: write docs

RPLACA

(RPLACA cell value)

Replace the CAR pointer of this cell with this value. Dangerous, should really not exist, but does in Lisp 1.5 (and was important for some performance hacks in early Lisps)

RPLACD

(RPLACD cell value)

Replace the CDR pointer of this cell with this value. Dangerous, should really not exist, but does in Lisp 1.5 (and was important for some performance hacks in early Lisps)

SUB1

(SUB1 x)

TODO: write docs

TIMES

(TIMES & args)

TODO: write docs

\ No newline at end of file diff --git a/docs/codox/beowulf.io.html b/docs/codox/beowulf.io.html index 1107af5..44b3afe 100644 --- a/docs/codox/beowulf.io.html +++ b/docs/codox/beowulf.io.html @@ -1,6 +1,6 @@ -beowulf.io documentation

beowulf.io

Non-standard extensions to Lisp 1.5 to read and write to the filesystem.

+beowulf.io documentation

beowulf.io

Non-standard extensions to Lisp 1.5 to read and write to the filesystem.

Lisp 1.5 had only READ, which read one S-Expression at a time, and various forms of PRIN* functions, which printed to the line printer. There was also PUNCH, which wrote to a card punch. It does not seem that there was any concept of an interactive terminal.

See Appendix E, OVERLORD - THE MONITOR, and Appendix F, LISP INPUT AND OUTPUT.

diff --git a/docs/codox/beowulf.oblist.html b/docs/codox/beowulf.oblist.html index 4488f32..c55a7f0 100644 --- a/docs/codox/beowulf.oblist.html +++ b/docs/codox/beowulf.oblist.html @@ -1,4 +1,4 @@ -beowulf.oblist documentation

beowulf.oblist

A namespace mainly devoted to the object list.

+beowulf.oblist documentation

beowulf.oblist

A namespace mainly devoted to the object list.

Yes, this makes little sense, but if you put it anywhere else you end up in cyclic dependency hell.

*options*

dynamic

Command line options from invocation.

NIL

The canonical empty list symbol.

oblist

The default environment.

\ No newline at end of file diff --git a/docs/codox/beowulf.read.html b/docs/codox/beowulf.read.html index e9893d6..9dd775f 100644 --- a/docs/codox/beowulf.read.html +++ b/docs/codox/beowulf.read.html @@ -1,6 +1,6 @@ -beowulf.read documentation

beowulf.read

This provides the reader required for boostrapping. It’s not a bad reader - it provides feedback on errors found in the input - but it isn’t the real Lisp reader.

+beowulf.read documentation

beowulf.read

This provides the reader required for boostrapping. It’s not a bad reader - it provides feedback on errors found in the input - but it isn’t the real Lisp reader.

Intended deviations from the behaviour of the real Lisp reader are as follows:

  1. It reads the meta-expression language MEXPR in addition to the symbolic expression language SEXPR, which I do not believe the Lisp 1.5 reader ever did;
  2. diff --git a/docs/codox/beowulf.reader.char-reader.html b/docs/codox/beowulf.reader.char-reader.html index 72b9707..5feb014 100644 --- a/docs/codox/beowulf.reader.char-reader.html +++ b/docs/codox/beowulf.reader.char-reader.html @@ -1,6 +1,6 @@ -beowulf.reader.char-reader documentation

    beowulf.reader.char-reader

    Provide sensible line editing, auto completion, and history recall.

    +beowulf.reader.char-reader documentation

    beowulf.reader.char-reader

    Provide sensible line editing, auto completion, and history recall.

    None of what’s needed here is really working yet, and a pull request with a working implementation would be greatly welcomed.

    What’s needed (rough specification)

      diff --git a/docs/codox/beowulf.reader.generate.html b/docs/codox/beowulf.reader.generate.html index bd7730a..67d292b 100644 --- a/docs/codox/beowulf.reader.generate.html +++ b/docs/codox/beowulf.reader.generate.html @@ -1,6 +1,6 @@ -beowulf.reader.generate documentation

      beowulf.reader.generate

      Generating S-Expressions from parse trees.

      +beowulf.reader.generate documentation

      beowulf.reader.generate

      Generating S-Expressions from parse trees.

      From Lisp 1.5 Programmers Manual, page 10

      Note that I’ve retyped much of this, since copy/pasting out of PDF is less than reliable. Any typos are mine.

      Quote starts:

      diff --git a/docs/codox/beowulf.reader.macros.html b/docs/codox/beowulf.reader.macros.html index 7a5424f..e3d7b6e 100644 --- a/docs/codox/beowulf.reader.macros.html +++ b/docs/codox/beowulf.reader.macros.html @@ -1,3 +1,3 @@ -beowulf.reader.macros documentation

      beowulf.reader.macros

      Can I implement reader macros? let’s see!

      *readmacros*

      dynamic

      TODO: write docs

      expand-macros

      (expand-macros form)

      TODO: write docs

      \ No newline at end of file +beowulf.reader.macros documentation

      beowulf.reader.macros

      Can I implement reader macros? let’s see!

      *readmacros*

      dynamic

      TODO: write docs

      expand-macros

      (expand-macros form)

      TODO: write docs

      \ No newline at end of file diff --git a/docs/codox/beowulf.reader.parser.html b/docs/codox/beowulf.reader.parser.html index c21ace6..b22edc5 100644 --- a/docs/codox/beowulf.reader.parser.html +++ b/docs/codox/beowulf.reader.parser.html @@ -1,3 +1,3 @@ -beowulf.reader.parser documentation

      beowulf.reader.parser

      The actual parser, supporting both S-expression and M-expression syntax.

      parse

      Parse a string presented as argument into a parse tree which can then be operated upon further.

      \ No newline at end of file +beowulf.reader.parser documentation

      beowulf.reader.parser

      The actual parser, supporting both S-expression and M-expression syntax.

      parse

      Parse a string presented as argument into a parse tree which can then be operated upon further.

      \ No newline at end of file diff --git a/docs/codox/beowulf.reader.simplify.html b/docs/codox/beowulf.reader.simplify.html index b38c76b..90989bf 100644 --- a/docs/codox/beowulf.reader.simplify.html +++ b/docs/codox/beowulf.reader.simplify.html @@ -1,4 +1,4 @@ -beowulf.reader.simplify documentation

      beowulf.reader.simplify

      Simplify parse trees. Be aware that this is very tightly coupled with the parser.

      remove-nesting

      (remove-nesting tree context)

      TODO: write docs

      remove-optional-space

      (remove-optional-space tree)

      TODO: write docs

      simplify

      (simplify p)(simplify p context)

      Simplify this parse tree p. If p is an instaparse failure object, throw an ex-info, with p as the value of its :failure key.

      +beowulf.reader.simplify documentation

      beowulf.reader.simplify

      Simplify parse trees. Be aware that this is very tightly coupled with the parser.

      remove-nesting

      (remove-nesting tree context)

      TODO: write docs

      remove-optional-space

      (remove-optional-space tree)

      TODO: write docs

      simplify

      (simplify p)(simplify p context)

      Simplify this parse tree p. If p is an instaparse failure object, throw an ex-info, with p as the value of its :failure key.

      NOTE THAT it is assumed that remove-optional-space has been run on the parse tree BEFORE it is passed to simplify.

      \ No newline at end of file diff --git a/docs/codox/beowulf.trace.html b/docs/codox/beowulf.trace.html index e2df591..1e6a6d3 100644 --- a/docs/codox/beowulf.trace.html +++ b/docs/codox/beowulf.trace.html @@ -1,3 +1,3 @@ -beowulf.trace documentation

      beowulf.trace

      Tracing of function execution

      TRACE

      (TRACE s)

      Add this symbol s to the set of symbols currently being traced. If s is not a symbol, does nothing.

      traced-symbols

      Symbols currently being traced.

      traced?

      (traced? s)

      Return true iff s is a symbol currently being traced, else nil.

      UNTRACE

      (UNTRACE s)

      TODO: write docs

      \ No newline at end of file +beowulf.trace documentation

      beowulf.trace

      Tracing of function execution

      TRACE

      (TRACE s)

      Add this symbol s to the set of symbols currently being traced. If s is not a symbol, does nothing.

      traced-symbols

      Symbols currently being traced.

      traced?

      (traced? s)

      Return true iff s is a symbol currently being traced, else nil.

      UNTRACE

      (UNTRACE s)

      TODO: write docs

      \ No newline at end of file diff --git a/docs/codox/index.html b/docs/codox/index.html index 2c78db7..720cbc8 100644 --- a/docs/codox/index.html +++ b/docs/codox/index.html @@ -1,3 +1,3 @@ -Beowulf 0.2.1-SNAPSHOT

      Beowulf 0.2.1-SNAPSHOT

      Released under the GPL-2.0-or-later

      An implementation of LISP 1.5 in Clojure.

      Installation

      To install, add the following dependency to your project or build file:

      [beowulf "0.2.1-SNAPSHOT"]

      Topics

      Namespaces

      beowulf.bootstrap

      Lisp as defined in Chapter 1 (pages 1-14) of the Lisp 1.5 Programmer's Manual; that is to say, a very simple Lisp language, which should, I believe, be sufficient in conjunction with the functions provided by beowulf.host, be sufficient to bootstrap the full Lisp 1.5 interpreter..

      beowulf.cons-cell

      The fundamental cons cell on which all Lisp structures are built. Lisp 1.5 lists do not necessarily have a sequence as their CDR, and must have both CAR and CDR mutable, so cannot be implemented on top of Clojure lists.

      beowulf.core

      Essentially, the -main function and the bootstrap read-eval-print loop.

      Public variables and functions:

      beowulf.host

      provides Lisp 1.5 functions which can’t be (or can’t efficiently be) implemented in Lisp 1.5, which therefore need to be implemented in the host language, in this case Clojure.

      beowulf.io

      Non-standard extensions to Lisp 1.5 to read and write to the filesystem.

      Public variables and functions:

      beowulf.oblist

      A namespace mainly devoted to the object list.

      Public variables and functions:

      beowulf.read

      This provides the reader required for boostrapping. It’s not a bad reader - it provides feedback on errors found in the input - but it isn’t the real Lisp reader.

      Public variables and functions:

      beowulf.reader.char-reader

      Provide sensible line editing, auto completion, and history recall.

      Public variables and functions:

      beowulf.reader.macros

      Can I implement reader macros? let’s see!

      Public variables and functions:

      beowulf.reader.parser

      The actual parser, supporting both S-expression and M-expression syntax.

      Public variables and functions:

      beowulf.reader.simplify

      Simplify parse trees. Be aware that this is very tightly coupled with the parser.

      Public variables and functions:

      beowulf.trace

      Tracing of function execution

      Public variables and functions:

      \ No newline at end of file +Beowulf 0.2.1

      Beowulf 0.2.1

      Released under the GPL-2.0-or-later

      An implementation of LISP 1.5 in Clojure.

      Installation

      To install, add the following dependency to your project or build file:

      [beowulf "0.2.1"]

      Topics

      Namespaces

      beowulf.bootstrap

      Lisp as defined in Chapter 1 (pages 1-14) of the Lisp 1.5 Programmer's Manual; that is to say, a very simple Lisp language, which should, I believe, be sufficient in conjunction with the functions provided by beowulf.host, be sufficient to bootstrap the full Lisp 1.5 interpreter..

      beowulf.cons-cell

      The fundamental cons cell on which all Lisp structures are built. Lisp 1.5 lists do not necessarily have a sequence as their CDR, and must have both CAR and CDR mutable, so cannot be implemented on top of Clojure lists.

      beowulf.core

      Essentially, the -main function and the bootstrap read-eval-print loop.

      Public variables and functions:

      beowulf.host

      provides Lisp 1.5 functions which can’t be (or can’t efficiently be) implemented in Lisp 1.5, which therefore need to be implemented in the host language, in this case Clojure.

      beowulf.io

      Non-standard extensions to Lisp 1.5 to read and write to the filesystem.

      Public variables and functions:

      beowulf.oblist

      A namespace mainly devoted to the object list.

      Public variables and functions:

      beowulf.read

      This provides the reader required for boostrapping. It’s not a bad reader - it provides feedback on errors found in the input - but it isn’t the real Lisp reader.

      Public variables and functions:

      beowulf.reader.char-reader

      Provide sensible line editing, auto completion, and history recall.

      Public variables and functions:

      beowulf.reader.macros

      Can I implement reader macros? let’s see!

      Public variables and functions:

      beowulf.reader.parser

      The actual parser, supporting both S-expression and M-expression syntax.

      Public variables and functions:

      beowulf.reader.simplify

      Simplify parse trees. Be aware that this is very tightly coupled with the parser.

      Public variables and functions:

      beowulf.trace

      Tracing of function execution

      Public variables and functions:

      \ No newline at end of file diff --git a/docs/codox/intro.html b/docs/codox/intro.html index c695c6e..9d91795 100644 --- a/docs/codox/intro.html +++ b/docs/codox/intro.html @@ -1,6 +1,6 @@ -beowulf

      beowulf

      +beowulf

      beowulf

      LISP 1.5 is to all Lisp dialects as Beowulf is to Emglish literature.

      What this is

      A work-in-progress towards an implementation of Lisp 1.5 in Clojure. The objective is to build a complete and accurate implementation of Lisp 1.5 as described in the manual, with, in so far as is possible, exactly the same bahaviour - except as documented below.

      diff --git a/docs/codox/mexpr.html b/docs/codox/mexpr.html index 299043c..b3e0ce9 100644 --- a/docs/codox/mexpr.html +++ b/docs/codox/mexpr.html @@ -1,6 +1,6 @@ -M-Expressions

      M-Expressions

      +M-Expressions

      M-Expressions

      M-Expressions (‘mexprs’) are the grammar which John McCarthy origininally used to write Lisp, and the grammar in which many of the function definitions in the Lisp 1.5 Programmer’s Manual are stated. However, I have not seen anywhere a claim that Lisp 1.5 could read M-Expressions, and it is not clear to me whether it was even planned that it should do so.

      Rather, it seems to me probably that M-Expressions were only ever a grammar intended to be written on paper, like Backus Naur Form, to describe and to reason about algorithms.

      I set out to make Beowulf read M-Expressions essentially out of curiousity, to see whether it could be done. I had this idea that if it could be done, I could implement most of Lisp 1.5 simply by copying in the M-Expression definitions out of the manual.

      diff --git a/project.clj b/project.clj index 501713b..d343c64 100644 --- a/project.clj +++ b/project.clj @@ -1,4 +1,4 @@ -(defproject beowulf "0.2.1" +(defproject beowulf "0.2.2-SNAPSHOT" :cloverage {:output "docs/cloverage" :ns-exclude-regex [#"beowulf\.gendoc"]} :codox {:metadata {:doc "**TODO**: write docs"