The document discusses LIPS programming and provides information on:
- The history and origins of LIPS, which was invented in 1958 and is suitable for artificial intelligence programs.
- Common LIPS, which originated in the 1980s-1990s to unify different LIPS implementations, serves as a common language that can be extended for specific uses.
- Features of Common LIPS include being machine-independent, allowing dynamic updating and debugging, and providing advanced object-oriented programming and data types.
- Examples of large successful applications built using LIPS include Emacs, G2, AutoCad, and Yahoo Store.
Download as PPTX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
149 views
LIPS Programming: Farhad Muhammad Riaz
The document discusses LIPS programming and provides information on:
- The history and origins of LIPS, which was invented in 1958 and is suitable for artificial intelligence programs.
- Common LIPS, which originated in the 1980s-1990s to unify different LIPS implementations, serves as a common language that can be extended for specific uses.
- Features of Common LIPS include being machine-independent, allowing dynamic updating and debugging, and providing advanced object-oriented programming and data types.
- Examples of large successful applications built using LIPS include Emacs, G2, AutoCad, and Yahoo Store.
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 26
LIPS Programming
Farhad Muhammad Riaz
LISP - Overview John McCarthy invented LISP in 1958, shortly after the development of FORTRAN. It was first implemented by Steve Russell on an IBM 704 computer. It is particularly suitable for Artificial Intelligence programs, as it processes symbolic information effectively. Common Lisp originated, during the 1980s and 1990s, in an attempt to unify the work of several implementation groups that were successors to Maclisp, like ZetaLisp and NIL (New Implementation of Lisp) etc. It serves as a common language, which can be easily extended for specific implementation. Programs written in Common LISP do not depend on machine- specific characteristics, such as word length etc. Features of Common LISP It is machine-independent It uses iterative design methodology, and easy extensibility. It allows updating the programs dynamically. It provides high level debugging. It provides advanced object-oriented programming. It provides a convenient macro system. It provides wide-ranging data types like, objects, structures, lists, vectors, adjustable arrays, hash-tables, and symbols. It is expression-based. It provides an object-oriented condition system. It provides a complete I/O library. It provides extensive control structures. Applications Built in LISP Large successful applications built in Lisp. Emacs G2 AutoCad Igor Engraver Yahoo Store LISP - Environment Setup Local Environment Setup If you are still willing to set up your environment for Lisp programming language, you need the following two softwares available on your computer, (a) Text Editor and (b) The Lisp Executer. Text Editor This will be used to type your program. Examples of few editors include Windows Notepad, OS Edit command, Brief, Epsilon, EMACS, and vim or vi. Name and version of text editor can vary on different operating systems. For example, Notepad will be used on Windows, and vim or vi can be used on windows as well as Linux or UNIX. The files you create with your editor are called source files and contain program source code. The source files for Lisp programs are typically named with the extension ".lisp". Before starting your programming, make sure you have one text editor in place and you have enough experience to write a computer program, save it in a file, finally execute it. LISP - Environment Setup The Lisp Executer The source code written in source file is the human readable source for your program. It needs to be "executed", to turn into machine language so that your CPU can actually execute the program as per instructions given. This Lisp programming language will be used to execute your source code into final executable program. I assume you have basic knowledge about a programming language. CLISP is the GNU Common LISP multi-architechtural compiler used for setting up LISP in Windows. The windows version emulates a unix environment using MingW under windows. The installer takes care of this and automatically adds clisp to the windows PATH variable. You can get the latest CLISP for Windows from here - https://sourceforge.net/projects/clisp/files/latest/download How to use CLISP During installation, clisp is automatically added to your PATH variable if you select the option (RECOMMENDED) This means that you can simply open a new Command Prompt window and type “clisp” to bring up the compiler. To run a *.lisp or *.lsp file, simply use − clisp hello.lisp LISP - Program Structure LISP expressions are called symbolic expressions or s- expressions. The s-expressions are composed of three valid objects, atoms, lists and strings. Any s-expression is a valid program. LISP programs run either on an interpreter or as compiled code. The interpreter checks the source code in a repeated loop, which is also called the read-evaluate-print loop (REPL). It reads the program code, evaluates it, and prints the values returned by the program. A Simple Program Let us write an s-expression to find the sum of three numbers 7, 9 and 11. To do this, we can type at the interpreter prompt. LISP Uses Prefix Notation Evaluation of LISP Programs Evaluation of LISP programs has two parts − Translation of program text into Lisp objects by a reader program Implementation of the semantics of the language in terms of these objects by an evaluator program The evaluation process takes the following steps − The reader translates the strings of characters to LISP objects or s- expressions. The evaluator defines syntax of Lisp forms that are built from s- expressions. This second level of evaluation defines a syntax that determines which s-expressions are LISP forms. The evaluator works as a function that takes a valid LISP form as an argument and returns a value. This is the reason why we put the LISP expression in parenthesis, because we are sending the entire expression/form to the evaluator as arguments. The 'Hello World' Program Basic Building Blocks in LISP LISP programs are made up of three basic building blocks atom list string An atom is a number or string of contiguous characters. It includes numbers and special characters. A list is a sequence of atoms and/or other lists enclosed in parentheses
A string is a group of characters enclosed in double
quotation marks. Adding Comments The semicolon symbol (;) is used for indicating a comment line. For Example, Data Types LISP - Decision Making LIPS Functions Structures