all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: pjb@informatimago.com (Pascal J. Bourguignon)
To: help-gnu-emacs@gnu.org
Subject: Re: What's the spec for emacs lisp virtual machine ?
Date: Fri, 23 Jul 2010 10:34:29 +0200	[thread overview]
Message-ID: <87d3ueiokq.fsf@kuiper.lan.informatimago.com> (raw)
In-Reply-To: d9e7d056-9ca9-4da5-b63f-632c34922ed9@q35g2000yqn.googlegroups.com

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	other threads:[~2010-07-23  8:34 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-23  6:12 What's the spec for emacs lisp virtual machine ? Fren Zeee
2010-07-23  8:34 ` Pascal J. Bourguignon [this message]
2010-07-23 15:59   ` Fren Zeee
2010-07-23 16:01     ` Fren Zeee
2010-07-23 16:03       ` Fren Zeee
2010-07-23 16:41         ` Pascal J. Bourguignon
2010-07-23 17:57         ` Barry Margolin
2010-07-23 16:40     ` Pascal J. Bourguignon
2010-07-30  3:51 ` mdj
2010-07-30  5:01   ` Fren Zeee
2010-07-30  5:28     ` mdj
2010-07-30  5:41       ` Fren Zeee
2010-08-02 19:35     ` Barry Margolin
  -- strict thread matches above, loose matches on Subject: below --
2010-07-23  6:15 Fren Zeee
2010-07-23  7:28 ` Alfred M. Szmidt
2010-07-23 16:18   ` Fren Zeee
2010-07-23 17:13     ` Chong Yidong
2010-07-23  7:51 ` Thien-Thi Nguyen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d3ueiokq.fsf@kuiper.lan.informatimago.com \
    --to=pjb@informatimago.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.