This article has two purposes: one is to describe a common method for implementing a computer language interpreter, and the other is to highlight how to use Python to implement a subset of the Lisp scheme. I refer to my interpreter as Lispy (lis.py). A few years ago, I introduced how to write a scheme interpreter using
This article has two purposes: one is to tell the general method of implementing the computer language interpreter, and the other is to show how to use Python to realize a subset of the scheme of Lisp dialect. I refer to my interpreter as Lispy (lis.py). A few years ago, I introduced how to write a scheme interpreter u
Compile a simple Lisp interpreter in Python.
This article has two purposes: one is to describe the general method of implementing the computer language interpreter, and the other is to show how to use Python to implement a subset of the Lisp dialect Scheme. I call my interpreter
describes the basic composition of the interpreter.The basic process from receiving the source program to the final execution of the interpreter is:
Lexical analysis. This step decomposes the source code into the smallest constituent element of the language (a short string of one). If var a = 1; it is broken down into a [‘var‘, ‘a‘, ‘=‘, ‘1‘] . Like this short string, we call it "Token".
Syntax analysis. This step analyzes the Token list
Lisp is a simple and powerful language with a very simple syntax:(+ 1 2)The above meaning is: + is a method or function, 1, 2 is a parameter, fn=1+2, that is, the sum is evaluated, the result is: 3Double brackets are used to remind the interpreter to start and end.Previously wrote an article in Iteye to briefly explain how to write Lisp's interpreter:http://gyc567.iteye.com/blog/2242960It also draws a sketc
CL's interpreter to become a CL development environment, and it automatically imports some packages (packages) to facilitate programmer programming. You can download Lispbox from here, the website provides the Windows, OS X, Linux three different operating systems under the Lispbox, you can according to your own needs, choose one.3 Use of IDE LispboxThis article explains the use of Lispbox in the Windows 7 system as an example. Once downloaded, you c
and Lisp. The chapters in front of this book are well understood, but in this last chapter, I have a lot of trouble. I spent a lot of time trying to understand the truth, but in the end, in retrospect, the main reason is that I did not have a proper practice environment, after reading a lot of books, I felt as if I understood the truth, but actually did not really understand clearly. However, two points in my opinion are undoubtedly certain: first,
this problem. This sentence is not completely correct. All of these languages are Turing equivalent, which means strictly speaking that you can use any of them to write any program. So how can we achieve this? In this small example, you can use these less powerful languages to write a Lisp interpreter.
This may sound like a joke, but it is widely used in large programming projects to varying degrees. There
we achieve this? In this small example, you can use these less powerful languages to write a lisp interpreter.
This may sound like a joke, but it is widely used in large programming projects to varying degrees. Therefore, some people name it Greenspun's Tenth Rule ):
"After any C or FORTRAN program is complex to a certain extent, it will contain a Common Lisp
lisp program. What are you going to write? (Whatever it is, as long as it is not Hello World)
Next, we will provide some common functions.
-- Sutra
We have seen the general appearance of a lisp program in the previous episode. At the end of the article, I mentioned that this set will be used to write a lisp interpreter
1. Go to Visual LISPTool> AutoLISP> Visual LISP editor. Alternatively, enter vlide in the command prompt to go to the user interface of viausl lisp.2. ExitClose button, or file-> exit. Note: In this case, AutoCAD does not uninstall Visual LISP, but only closes all visuallisp windows. The next time you start the visuallisp task, visuallisp automatically opens the
a list, the first case is executed when the computer processes the list. If there is no "'" before the list, the first item in the table has special significance, it is a command (in LISP, these commands are called functions ). For example:
(+ 2 3)
The result of this list execution (in terms of "evaluate the List") is 5, because the first item in the table is "+", indicating the sum of the remaining elements in the table. If you want to run the c
I 've been procrastinating, playing with Lisp, but I can't solve this problem after all. In this case, I started to shake my mind.
The author first complained and compared the differences between lisp macros and other languages. Formally speaking, the so-called standard macros are the same as class libraries such as c and java, it is the stuff that has been completed and verified in advance and encapsulated
Previously mentioned remote debugging of Lisp on an aircraft in the "Deep Space task"CodeThe story, I found the source, http://www.flownet.com/gat/jpl-lisp.html JPL is to promote the power laboratory, if you remember correctly, it seems that Qian Xuesen was involved in the creation.
The author mentioned in his article that he had been away from JPL and went to Google to work. He wanted to promote the application of
intelligence. Scheme, which originated in academia, was deliberately streamlined and validated as a good language for both computer science teaching and embedded scripting language. You may also encounter some of the more famous Lisp: Small, application-specific DSLs such as Emacs Lisp or AutoCAD AutoLisp.
The two main dialects mentioned above (dialect) are implemented on the JVM in a way that is more mat
modification, you can use any version of Common Lisp. See resources for a detailed description of the available Lisp version.
Like learning most other languages, the best way to learn Lisp is to practice. Open your interpreter and encode it with me. Lisp is basically a com
know how to use it, so in a later day, old books were sold. What surprised me now is why a programming language created in 1958 has such a strong vitality, today, functional programming has a tendency to replace object-oriented technology into a mainstream approach. "Why is the lisp language so advanced?" from a professional perspective, I have explained why lisp is special. There are many articles on the
Several free scheme (LISP) Interpreters
Keyword: Lisp Scheme
LISPIs an old FunctionProgramming LanguageScheme originated from a lisp dialect of MIT. Some features of the current programming language, such as tail recursion, anonymous functions, and dynamic changesCodeAnd so on, noIt is rarely inspired by lisp. Here w
Get start with "lisp"
In hacking and comics, Paul Graham mentioned what is the best programming language. LISP and C are obviously mentioned, and it is probably the same as lisp. Recently, I was going to read the tool. So I learned the extremely powerful lisp.
The basic, if primitive, way to get
Emacs has three lisp modes. The command name is as follows:
Emacs-lisp-mode for Emacs LISPCode(File name. emacs or suffix. El)LISP-mode is used to edit the lisp code (suffix. l or. LISP) of another lisp system)
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.