help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What's the spec for emacs lisp virtual machine ?


From: Pascal J. Bourguignon
Subject: Re: What's the spec for emacs lisp virtual machine ?
Date: Wed, 08 Dec 2010 15:20:17 -0000
User-agent: Gnus/5.101 (Gnus v5.10.10) Emacs/23.2 (gnu/linux)

Fren Zeee <frenzeee@gmail.com> 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/


reply via email to

[Prev in Thread] Current Thread [Next in Thread]