Dec 292017
Very Tiny Lisp (AI-Expert 4/87) com/doc. | |||
---|---|---|---|
File Name | File Size | Zip Size | Zip Type |
VTLISP.COM | 28544 | 16282 | deflated |
VTLISP.DOC | 3968 | 1657 | deflated |
Download File VTLISP.ZIP Here
Contents of the VTLISP.DOC file
VT-LISP - Very Tiny LISP
VT-LISP is a simple functional LISP interpreter provided with full
source code to encourage experimentation with LISP and functional
languages.
Startup
1. Boot the system.
2. Insert the disk containing VTLISP.COM in Drive A:
3. If the DOS prompt is not A>, type A: and press the ENTER key to switch
to drive A:.
4. Type VTLISP and press RETURN. VTLISP should respond with its heading
and a '-> ' prompt.
Entering S-expressions.
VT-LISP accepts S-expressions, evaluates them and prints the result of
the evaluation. You enter an S-expression by typing it directly from the
keyboard. As you enter S-expressions, the prompt may change to a number
followed by '>'. The number represents the number of unmatched
parentheses. For example:
VT-LISP - Copyright 1987 [c] Knowledge Garden Inc.
-> (cons 'a '(b c))
(a b c )
-> (letrec (append '(a b c) '(d e f))
1> (append (lambda (x y)
3> (if (eq x nil) y
4> (cons (car x) (append (cdr x) y))))))
(a b c d e f )
->(read 'b:append) ; read and evaluate the file b:append.lsp
Terminating VT-LISP
1. To exit VT-LISP, type :
(exit) .
at the '-> ' prompt. Don't forget the period.
VT-LISP Grammar
The following BNF describes the syntax of S-expressions
S-expression ::- atom | '(' expression-list ')'
atom ::- text-string | number
expression-list ::- S-expression | S-expression '.' S-expression |
S-expression expression-list
VT-LISP expressions
Variable
x - upper or lower case identifier
Constants
(QUOTE s)
's
Arithmetic expressions
(ADD expr1 expr2) (+ expr1 expr2)
(SUB expr1 expr2) (- expr1 expr2)
(MUL expr1 expr2) (* expr1 expr2)
(DIV expr1 expr2) (/ expr1 expr2)
(MOD expr1 expr2)
Comparisons
(EQ expr1 expr2) - returns T if expr1 evaluates to the same thing as expr2
(LT expr1 expr2) - returns T if expr1 < expr2
(GT expr1 expr2) - returns T if expr1 > expr2
(NEQ expr1 expr2) - returns T if expr1 <> expr2
S-expression operations
(CONS expr1 expr2) - returns dottted pair (expr1.expr2)
(CAR expr) - returns first element of expr
(CDR expr) - returne list formed by removing 1st element from expr
(ATOM expr) - returns T if expr evaluates to an atom
Conditional expression
(IF expr1 expr2 expr3) - If expr1 returns T, evaluate expr2, otherwise
evaluate expr3
Return to DOS
(EXIT)
Read an expression from a file
(read expr) - read an expression from file expr. expr must evaluate to an
atom which is represents a file name. File names must end
in ".LSP". Example: (read 'b:append)
Definition expressions
(LAMBDA (x1 x2 x3 ....) expr) - define a lambda expression
(LET expr (x1.expr1) (x2.expr2) .......) - define a block. x1 etc. are
local variables. expr1, expr2 etc are their deinitions
(LETREC expr (x1.expr1) (x2.expr2) ......) - define a recursive block
Function Call
(expr expr1 expr2 expr3 ...) - evaluate the function expr, using
parameters expr1 etc. Parameters are
evaluated before applying the function.
Comments
; - comments begin with ";". Anything following ";" on a line is ignored
by the evaluator
Good luck with VT-LISP. We would be very interested in hearing of
your experiments, enhancements or even (gasp) bugs that you may find.
Please write to us with your comments or questions.
Bill and Bev Thompson
C/O AI Expert Magazine
500 Howard St.
San Francisco, CA 94105
or on the AI Expert BBS on Compuserv. Our id is BillandBev Thompson,
[76703,4324]. You can also contact us on BIX, our id is bbt.
Bill and Bev Thompson
VT-LISP is a simple functional LISP interpreter provided with full
source code to encourage experimentation with LISP and functional
languages.
Startup
1. Boot the system.
2. Insert the disk containing VTLISP.COM in Drive A:
3. If the DOS prompt is not A>, type A: and press the ENTER key to switch
to drive A:.
4. Type VTLISP and press RETURN. VTLISP should respond with its heading
and a '-> ' prompt.
Entering S-expressions.
VT-LISP accepts S-expressions, evaluates them and prints the result of
the evaluation. You enter an S-expression by typing it directly from the
keyboard. As you enter S-expressions, the prompt may change to a number
followed by '>'. The number represents the number of unmatched
parentheses. For example:
VT-LISP - Copyright 1987 [c] Knowledge Garden Inc.
-> (cons 'a '(b c))
(a b c )
-> (letrec (append '(a b c) '(d e f))
1> (append (lambda (x y)
3> (if (eq x nil) y
4> (cons (car x) (append (cdr x) y))))))
(a b c d e f )
->(read 'b:append) ; read and evaluate the file b:append.lsp
Terminating VT-LISP
1. To exit VT-LISP, type :
(exit) .
at the '-> ' prompt. Don't forget the period.
VT-LISP Grammar
The following BNF describes the syntax of S-expressions
S-expression ::- atom | '(' expression-list ')'
atom ::- text-string | number
expression-list ::- S-expression | S-expression '.' S-expression |
S-expression expression-list
VT-LISP expressions
Variable
x - upper or lower case identifier
Constants
(QUOTE s)
's
Arithmetic expressions
(ADD expr1 expr2) (+ expr1 expr2)
(SUB expr1 expr2) (- expr1 expr2)
(MUL expr1 expr2) (* expr1 expr2)
(DIV expr1 expr2) (/ expr1 expr2)
(MOD expr1 expr2)
Comparisons
(EQ expr1 expr2) - returns T if expr1 evaluates to the same thing as expr2
(LT expr1 expr2) - returns T if expr1 < expr2
(GT expr1 expr2) - returns T if expr1 > expr2
(NEQ expr1 expr2) - returns T if expr1 <> expr2
S-expression operations
(CONS expr1 expr2) - returns dottted pair (expr1.expr2)
(CAR expr) - returns first element of expr
(CDR expr) - returne list formed by removing 1st element from expr
(ATOM expr) - returns T if expr evaluates to an atom
Conditional expression
(IF expr1 expr2 expr3) - If expr1 returns T, evaluate expr2, otherwise
evaluate expr3
Return to DOS
(EXIT)
Read an expression from a file
(read expr) - read an expression from file expr. expr must evaluate to an
atom which is represents a file name. File names must end
in ".LSP". Example: (read 'b:append)
Definition expressions
(LAMBDA (x1 x2 x3 ....) expr) - define a lambda expression
(LET expr (x1.expr1) (x2.expr2) .......) - define a block. x1 etc. are
local variables. expr1, expr2 etc are their deinitions
(LETREC expr (x1.expr1) (x2.expr2) ......) - define a recursive block
Function Call
(expr expr1 expr2 expr3 ...) - evaluate the function expr, using
parameters expr1 etc. Parameters are
evaluated before applying the function.
Comments
; - comments begin with ";". Anything following ";" on a line is ignored
by the evaluator
Good luck with VT-LISP. We would be very interested in hearing of
your experiments, enhancements or even (gasp) bugs that you may find.
Please write to us with your comments or questions.
Bill and Bev Thompson
C/O AI Expert Magazine
500 Howard St.
San Francisco, CA 94105
or on the AI Expert BBS on Compuserv. Our id is BillandBev Thompson,
[76703,4324]. You can also contact us on BIX, our id is bbt.
Bill and Bev Thompson
December 29, 2017
Add comments