90 likes | 237 Views
LISP – Not just a Speech Impediment. Jim Lowe. Brief History of LISP. Initial development begins at the Dartmouth Summer Research Project in 1956 by Dr John McCarthy. At the time, Fortran was the only high level programming language available.
E N D
LISP – Not just a Speech Impediment Jim Lowe
Brief History of LISP • Initial development begins at the Dartmouth Summer Research Project in 1956 by Dr John McCarthy. • At the time, Fortran was the only high level programming language available. • Dr. McCarthy and his colleagues were interested in producing a language more suited for manipulating data in a similar manner to human thought….Artificial Intelligence. • Language development was completed at MIT and was made available to the general computer science community in 1963.
Innovations of LISP • First functional language. • Emphasis is on the evaluation of expressions rather than the execution of commands. • Recursion • The concept of a function calling itself until a predefined base case was reached was a significant step forward in CS. LISP memory management was developed to allow for recursion. • Recursion was a mathematical concept applied to a computer. • Object Orientation • The basic unit of data in LISP is a list. This data structure is ideally suited for definition of a weak typed object. For example, animals could be defined as; • (animals ‘(cat brown) (dog white) (bird purple)) • (animals ‘(cat brown dumb) (dog white smart))
Inovations of LISP (cont.) • Object Orientation (cont) • This concept was developed to provide for programming a computer to think like a human • Functions can be defined as objects and passed as arguments. • Garbage Collection • Memory management was handled by the interpreter. • Conditionals • A conditional is an if-then-else construct. We take these for granted now. • FORTRAN used GOTO • Variables • In LISP all variables are pointers, this allowed for the reduction of data storage requirements for recursive functions.
LISP BNF Grammar • All LISP expressions built from simple grammar rules • Atom = NULL OR Letter OR Number • Letter = “A” OR “B” OR “C”….OR “Z” • Number = “0” OR “1” or “2” …OR “9” • S-Expression = Atom OR (S-Expression “.” S-Expression) OR List. • List = ‘({S-Expression “ “}* ) • NULL = “” • Atoms can be used to represent values and passed as these values. For example we may need to define PI to equal 3.1415 or FRED to equal “Fredrick the 3rd of Nowhere.” To do this, LISP binds a value to the variable representation. With the function “setq”.
Functionality of LISP • LISP can be compiled or interpreted. • Early LISPwas interpreted only. This was of particular importance due to a complete lack of computer operating system standardization. • Later versions (c. 1968) provided for compilation to take advantage of LISP machines. LISP Machines were computers built solely to execute LISP instructions. • Variable visibility is limited to descendants from point of definition • There is no real distinction between read-time, compile-time, and runtime. • You can compile or run code while reading, read or run code while compiling, and read or compile code at runtime.
LISP today • LISP is currently standardized in many different forms. • ANSI standard X3.226 • ISI (International Standards Institute) 13816.1997 • Many of the descendants of LISP are also standardized. • Scheme : Educational and Research language. • Arc : A modern LISP derivative. • AutoLISP : A dialect used for CAD applications. • Dylan : An object-oriented dialect of LISP. • Emacs LISP : Text editor extension language.
Advantages of LISP • Programs are easy to test due to interactive interpreter environment. • Portable across hardware platforms with supported interpreters. • Clear and concise syntax and semantics. • Automatic memory management and garbage collection. • Packaging of programs into modules. • Flexible data structures. • Object oriented capability.
Disadvantages of LISP • Limited availability of compilers – Increased program size and run time. • Cross platform compatibility requires multiple interpreter environments. • Small install base creates limited audience for programs. • Other computer programmers make fun of you because you “talk” funny.