ShenDoc 30


 

 

KLambda and the Shen Evaluator

The Shen evaluator compiles Shen into Kλ and Kλ into native code. The Shen evaluator accepts S-exprs as legal input and since Kλ expressions are such, any Kλ expression is a legal input to Shen. Note that if a Kλ expression is typed into Shen, that special constructions such as the list/string/vectors constructors in Shen which are outside the Kλ spec (see the sections below) will actually work within such expressions because they are compiled into legal Kλ. Thus the function;

A. (defun list-all (x y z) [x y z])

is not legal Kλ and would have to be written as follows to be legal Kλ

B. (defun list-all (x y z) (cons x (cons y (cons z ()))))

However expression A. will be accepted and compiled by Shen into expression B.

Hence hybrid programming will work in Shen. We don't actually recommend this style, because Kλ is not designed for the purposes of programming, but for easy porting and implementation. However you can write Kλ code in Shen which is as compact as Common Lisp.

Acknowledgements

History
Basic Types in Shen and Kλ
The Primitive Functions of Kλ
The Syntax of Kλ
Notes on the Implementation of Kλ
Boolean Operators
The Syntax of Symbols
The Semantics of Symbols in Shen and Kλ
Packages
Prolog
Shen-YACC
Strings
Strings and Pattern Matching
Lists
Streams
Character Streams and Byte Streams
Bytes and Unicode
Reader Macros
Vectors
Standard Vectors and Pattern Matching
Non-standard Vectors and Tuples
Equality
I/O
Generic Functions
Eval
Type Declarations
External Global Variables
Property Lists and Hashing
Error Handling
Numbers
Floats and Integers
The Timer
Comments
Special Forms

Built by Shen Technology (c) Mark Tarver, September 2021