WEGMAN.YKTVMZ%ibm-sj.csnet@csnet-relay.arpa (08/03/84)
From: Mark N. Wegman <WEGMAN.YKTVMZ%ibm-sj.csnet@csnet-relay.arpa> LISP/VM Features ? Data types ? Numbers include small integers (up to 26 bits), in- tegers of arbitrary precision (bignums) and floating point numbers (7 bit exponent and 56 bit fraction). ? Identifiers include characters and gensyms. ? Pairs (lists or conses) ? Vectors of arbitrary objects, integers, floating point numbers, characters, or bits (Boolean values). ? Hashtables can hash on pointers or structure. ? Readtables allow prefix and infix character and dis- patch macros. ? State descriptors capture the control and environ- ment components of an evaluation in a single object. ? Streams are the interface to data in external files. ? Functions and macros, both interpreted and compiled are ordinary data objects. ? Funargs combine a function or macro and a state de- scriptor to provide a form of closure. ? Scope and Extent ? Variable bindings normally have lexical scope. ? Variable bindings that are declared fluid have dy- namic scope. ? Control points established by CATCH and related con- structs have dynamic scope. ? Labels (or GO targets) have lexical scope. ? Evaluation rules ? Self-evaluating forms (constants) consist of the numbers, character vectors, bit vectors and NIL. ? Identifiers (symbols or variables) evaluate to a current lambda-bound value or to a default value stored in a non-lambda environment. Special forms as well as macros and function invocations are recognized by evaluating the CAR of a compound form. This feature allows all operators in LISP/VM to be re- defined by the user in order to modify or extend the se- mantics of the language. ? The special forms are: CLOSEDFN FUNCTION PROGN COND GO QUOTE EVALQ GVALUE RETURN EXIT LAMBDA SEQ F*CODE MLAMBDA SETQ ? Macros are applied to the invoking form and the value of the macro call is re-evaluated. A macro is defined by assignment or lambda-binding. ? Functions may have a fixed or variable number of ar- guments. Functions are defined by assignment or lambda-binding. ? The bound variable part of functions and macros may be a pattern that specifies the structure of an ar- gument. Specified components of an argument may be bound to distinct variables. ? In addition to all the usual type and numeric predi- cates, LISP/VM includes three forms of structural equal- ity: ? EQUAL is the traditional equality test. Atomic ob- jects are EQUAL if their external forms are identi- cal. Two composite objects are EQUAL if for any combination of access operations the corresponding components are EQUAL. ? UEQUAL test for structural equivalence (isomorphism). ? UGEQUAL tests for structural equivalence and allows different gensyms in two objects if their patterns of occurrence are isomorphic. ? All three equality predicates terminate for all data objects, including objects with shared and circular structure. ? Control structure ? Simple sequencing constructs include PROGN, PROG1, PROG2 and COND. ? SEQ defines a sequential context and a scope for la- bels and EXIT expressions. ? PROG defines a scope for labels as well as a set of variables, and a scope for RETURN expressions. ? Iterators include the MACLISP-style DO as well as most of the INTERLISP iteration constructs. ? Mapping operators include MAP, MAPCAR, MAPCAN, as well as operators that map over vectors. ? Non-local exits are possible with CATCH, THROW, THROW-PROTECT, and similar constructs. ? State saving and application allows co-routining, backtracking and other non-LIFO control models. ? Identifiers (symbols) have a pname and a property list. There is no function-value cell, since function defi- nition is assignment. Characters are not a special case in LISP/VM, they are simply the identifiers with a one-character pname. Gensyms are identifiers that are created anew each time they are read. ? Operations on numbers include all the usual arithmetic functions and a set of in-line operators for small inte- ger arithmetic. ? Operations on lists normally terminate or signal an er- ror when the list is circular. ? Hash tables allow hashing on pointers, structure, or the contents of character strings. ? Operations on vectors include specialized operations on character vectors (strings). ? Structured data definitions allow named access to the components of a data object. ? The compiler can be invoked dynamically to compile from and/or to the LISP/VM heap or external files. In most cases, compiled and interpreted definitions are equiv- alent and interchangeable. Compilations take place in an environment that may con- tain alternate definitions for operators. Thus, an op- erator can have a functional definition in the normal environment, and a macro definition that emits in-line code in the compile environment. ? Streams allow parsed or character-oriented data trans- mission between LISP/VM and the external file system. ? Input/Output ? The PRINT function produces an external form for ev- ery LISP/VM data object. In addition, shared sub- structure is revealed by markers in the external form; these markers are recognized by the READ func- tion. ? The input syntax is determined by a readtable that defines a wide variety of character attributes. ? Storage allocation ? There are no fixed allocations of storage within LISP/VM. The boundaries between heap, stack, com- piled programs, etc., are adjusted dynamically to make full use of the available memory. ? Garbage collection is done by a copying algorithm that takes time proportional to the amount of data that survives the collection. ? A MACLISP compatibility package allows existing applica- tions to be compiled for use in the LISP/VM environment