From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: pjb@informatimago.com (Pascal J. Bourguignon) Newsgroups: gmane.emacs.help Subject: Re: What's the spec for emacs lisp virtual machine ? Date: Fri, 23 Jul 2010 10:34:29 +0200 Organization: Informatimago Message-ID: <87d3ueiokq.fsf@kuiper.lan.informatimago.com> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1291849398 2330 80.91.229.12 (8 Dec 2010 23:03:18 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 8 Dec 2010 23:03:18 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Dec 09 00:03:14 2010 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PQT2W-0008RS-LL for geh-help-gnu-emacs@m.gmane.org; Thu, 09 Dec 2010 00:03:12 +0100 Original-Received: from localhost ([127.0.0.1]:45928 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PQT2V-0007BV-NV for geh-help-gnu-emacs@m.gmane.org; Wed, 08 Dec 2010 18:03:11 -0500 Original-Path: usenet.stanford.edu!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: gnu.emacs.help,comp.lang.lisp Original-Lines: 123 Original-X-Trace: individual.net 0SkveJXvT9hZBtkOS9XPSQfRAxAq+uFi7ZkOcaNcaKyPbHWVpB Cancel-Lock: sha1:NDFhYzE3ZmMzNzdjZmZmODc5NmYxOTk5YzIwNDgyNDUzZmNjMWE2Yw== sha1:LlKVE6NG7jVDhRwzrbupHyMb0Qw= Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAQMAAABtzGvEAAAABlBMVEUAAAD///+l2Z/dAAAA oElEQVR4nK3OsRHCMAwF0O8YQufUNIQRGIAja9CxSA55AxZgFO4coMgYrEDDQZWPIlNAjwq9 033pbOBPtbXuB6PKNBn5gZkhGa86Z4x2wE67O+06WxGD/HCOGR0deY3f9Ijwwt7rNGNf6Oac l/GuZTF1wFGKiYYHKSFAkjIo1b6sCYS1sVmFhhhahKQssRjRT90ITWUk6vvK3RsPGs+M1RuR mV+hO/VvFAAAAABJRU5ErkJggg== X-Accept-Language: fr, es, en X-Disabled: X-No-Archive: no Importance: high User-Agent: Gnus/5.101 (Gnus v5.10.10) Emacs/23.2 (gnu/linux) Original-Xref: usenet.stanford.edu gnu.emacs.help:179962 comp.lang.lisp:290562 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:76180 Archived-At: Fren Zeee writes: > What's the spec for emacs lisp virtual machine ? The source code of emacs. > Where are the complete set of virtual machine commands ? In src/bytecode.c > Where is the theory for such a virtual machine in the clearest > description ? (not general theory, but one applicable directly to > understanding emacs vm.) It's really quite a simple VM. Just read the sources! > Does the emacs lisp operate as a stack push/pop or as parsing ? emacs lisp works like any other lisp. There's an abstract 'eval' that interprets it. Any good course about lisp would introduce it. > Why is a VM needed when there is compiled C code running machine > code ? Is this home work? Search the sources of emacs for compilers. How many compilers do you find? What are their source files? What machine do they target? > How do you implement a LISP interpreter using a stack based and syntax > tree methods ? Interpretation may be done without any consideration on the underlying architecture. > Some overview with concrete examples please, but of practical value. Perhaps you should not limit yourself to emacs lisp. Allow yourself to read also about other lisps, including scheme. You could also check the sources of various other Lisp, including: - sbcl or ccl, - clisp, and - ecl to answer the above questions for them as well as for emacs lisp. There's a lot of material out there. You could start with: http://www.informatimago.com/develop/lisp/small-cl-pgms/aim-8/ (that paper contains the original LISP interpreter). Googling for: lisp in lisp gives good results such as: http://lib.store.yahoo.net/lib/paulgraham/jmc.lisp http://www.softwarepreservation.org/projects/LISP/ http://www.schemers.org/Documents/Standards/R5RS/HTML/r5rs.html (this report contains (part of) formal specifications of scheme). > Also, for either you need a scanner and so an example of a scanner > using a transition table. How do you decide on the states that are > minimal and not redundant ? > > What is the difference between a stack architecture of a processor and > register based one ? Get a description of a stack architecture. Get a description of a register based processor. Compute the differences. If you're lazy, as it seems you are, you could just use google: stack vs register VM > wouldnt the former still need an ALU and indirect > addressing to do the job ? What do you think? > A diagram and some explanation, or else we > will be in the domain of linguistic ambiguity. Or even better, use formal specifications for the various kind of VM, and a formal specification of Lisp, and show how you can map the later to each one of the formers. > Upload a hand sketched image if necessary, or a reference to specific > pages in google books. > > I have done searches on wiki and other places but the things are not > entirely clear because they are not oriented to my goal of centering > around emacs. You need to read LiSP, which covers how to implement Lisp. LiSP = "Lisp in Small Pieces" http://www-spi.lip6.fr/~queinnec/WWW/LiSP.html This book covers Lisp, Scheme and other related dialects, their interpretation, semantics and compilation. To sum it up in a few figures: 500 pages, 11 chapters, 11 interpreters and 2 compilers. -- __Pascal Bourguignon__ http://www.informatimago.com/