all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* What's the spec for emacs lisp virtual machine ?
@ 2010-07-23  6:12 Fren Zeee
  2010-07-23  8:34 ` Pascal J. Bourguignon
  2010-07-30  3:51 ` mdj
  0 siblings, 2 replies; 18+ messages in thread
From: Fren Zeee @ 2010-07-23  6:12 UTC (permalink / raw
  To: help-gnu-emacs

What's the spec for emacs lisp virtual machine ?

Where are the complete set of virtual machine commands ?

Where is the theory for such a virtual machine in the clearest
description ? (not general theory, but one applicable directly to
understanding emacs vm.)

Does the emacs lisp operate as a stack push/pop or as parsing ?

Why is a VM needed when there is compiled C code running machine
code ?

How do you implement a LISP interpreter using a stack based and syntax
tree methods ?

Some overview with concrete examples please, but of practical value.

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 ? wouldnt the former still need an ALU and indirect
addressing to do the job ? A diagram and some explanation, or else we
will be in the domain of linguistic ambiguity.

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.


^ permalink raw reply	[flat|nested] 18+ messages in thread

* What's the spec for emacs lisp virtual machine ?
@ 2010-07-23  6:15 Fren Zeee
  2010-07-23  7:28 ` Alfred M. Szmidt
  2010-07-23  7:51 ` Thien-Thi Nguyen
  0 siblings, 2 replies; 18+ messages in thread
From: Fren Zeee @ 2010-07-23  6:15 UTC (permalink / raw
  To: Emacs Dev [emacs-devel]

What's the spec for emacs lisp virtual machine ?

Where are the complete set of virtual machine commands ?

Where is the theory for such a virtual machine in the clearest
description ? (not general theory, but one applicable directly to
understanding emacs vm.)

Does the emacs lisp operate as a stack push/pop or as parsing ?

Why is a VM needed when there is compiled C code running machine code ?

How do you implement a LISP interpreter using a stack based and syntax
tree methods ?

Some overview with concrete examples please, but of practical value.

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 ? wouldnt the former still need an ALU and indirect
addressing to do the job ? A diagram and some explanation, or else we
will be in the domain of linguistic ambiguity.

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.

Thanks
Franz Xe



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: What's the spec for emacs lisp virtual machine ?
  2010-07-23  6:15 What's the spec for emacs lisp virtual machine ? Fren Zeee
@ 2010-07-23  7:28 ` Alfred M. Szmidt
  2010-07-23 16:18   ` Fren Zeee
  2010-07-23  7:51 ` Thien-Thi Nguyen
  1 sibling, 1 reply; 18+ messages in thread
From: Alfred M. Szmidt @ 2010-07-23  7:28 UTC (permalink / raw
  To: Fren Zeee; +Cc: emacs-devel

   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.

Have you tried looking at the source code for emacs?  It isn't that
complex and the code is well commented, it is also the best place for
any details regarding emacs.  The VM is located in emacs/src/eval.c,
the byte-code compiler in emacs/lisp/emacs-lisp/bytecomp.el.  You can
use the disassemble function to disassemble emacs byte-code.



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: What's the spec for emacs lisp virtual machine ?
  2010-07-23  6:15 What's the spec for emacs lisp virtual machine ? Fren Zeee
  2010-07-23  7:28 ` Alfred M. Szmidt
@ 2010-07-23  7:51 ` Thien-Thi Nguyen
  1 sibling, 0 replies; 18+ messages in thread
From: Thien-Thi Nguyen @ 2010-07-23  7:51 UTC (permalink / raw
  To: Fren Zeee; +Cc: Emacs Dev [emacs-devel]

() Fren Zeee <frenzeee@gmail.com>
() Thu, 22 Jul 2010 23:15:17 -0700

   What's the spec for emacs lisp virtual machine ?

   [and other design questions]

I suggest you start a page on the Emacs wiki, and place these questions there.
This will more likely result in better responses and discussion than a thread
on this mailing list.



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: What's the spec for emacs lisp virtual machine ?
  2010-07-23  6:12 Fren Zeee
@ 2010-07-23  8:34 ` Pascal J. Bourguignon
  2010-07-23 15:59   ` Fren Zeee
  2010-07-30  3:51 ` mdj
  1 sibling, 1 reply; 18+ messages in thread
From: Pascal J. Bourguignon @ 2010-07-23  8:34 UTC (permalink / raw
  To: help-gnu-emacs

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/


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: What's the spec for emacs lisp virtual machine ?
  2010-07-23  8:34 ` Pascal J. Bourguignon
@ 2010-07-23 15:59   ` Fren Zeee
  2010-07-23 16:01     ` Fren Zeee
  2010-07-23 16:40     ` Pascal J. Bourguignon
  0 siblings, 2 replies; 18+ messages in thread
From: Fren Zeee @ 2010-07-23 15:59 UTC (permalink / raw
  To: help-gnu-emacs

On Jul 23, 1:34 am, p...@informatimago.com (Pascal J. Bourguignon)
wrote:
> Fren Zeee <frenz...@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/

unfortunately, this reply did not give any benefit and info repeated
before. the reply did not even put a snippet of the code from c file
to illustrate how he himself read and understood it. someone else try
if anyone knows.


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: What's the spec for emacs lisp virtual machine ?
  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:40     ` Pascal J. Bourguignon
  1 sibling, 1 reply; 18+ messages in thread
From: Fren Zeee @ 2010-07-23 16:01 UTC (permalink / raw
  To: help-gnu-emacs

On Jul 23, 8:59 am, Fren Zeee <frenz...@gmail.com> wrote:
> On Jul 23, 1:34 am, p...@informatimago.com (Pascal J. Bourguignon)
> wrote:
>
>
>
> > Fren Zeee <frenz...@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/
>
> unfortunately, this reply did not give any benefit and info repeated
> before. the reply did not even put a snippet of the code from c file
> to illustrate how he himself read and understood it. someone else try
> if anyone knows.

I already read and understood jmc's doc. he does nt seem to understand
the difference between stack based and tree based parsing.


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: What's the spec for emacs lisp virtual machine ?
  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
  0 siblings, 2 replies; 18+ messages in thread
From: Fren Zeee @ 2010-07-23 16:03 UTC (permalink / raw
  To: help-gnu-emacs

On Jul 23, 9:01 am, Fren Zeee <frenz...@gmail.com> wrote:
> On Jul 23, 8:59 am, Fren Zeee <frenz...@gmail.com> wrote:
>
>
>
> > On Jul 23, 1:34 am, p...@informatimago.com (Pascal J. Bourguignon)
> > wrote:
>
> > > Fren Zeee <frenz...@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/
>
> > unfortunately, this reply did not give any benefit and info repeated
> > before. the reply did not even put a snippet of the code from c file
> > to illustrate how he himself read and understood it. someone else try
> > if anyone knows.
>
> I already read and understood jmc's doc. he does nt seem to understand
> the difference between stack based and tree based parsing.

portability does not require VM, it only requires C while emacs
interprets the lisp code. a diff command in C is portable over
computers because its written in C. not because of a VM.


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: What's the spec for emacs lisp virtual machine ?
  2010-07-23  7:28 ` Alfred M. Szmidt
@ 2010-07-23 16:18   ` Fren Zeee
  2010-07-23 17:13     ` Chong Yidong
  0 siblings, 1 reply; 18+ messages in thread
From: Fren Zeee @ 2010-07-23 16:18 UTC (permalink / raw
  To: ams; +Cc: emacs-devel

On Fri, Jul 23, 2010 at 12:28 AM, Alfred M. Szmidt <ams@gnu.org> wrote:
>   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.
>
> Have you tried looking at the source code for emacs?  It isn't that
> complex and the code is well commented, it is also the best place for
> any details regarding emacs.  The VM is located in emacs/src/eval.c,
> the byte-code compiler in emacs/lisp/emacs-lisp/bytecomp.el.  You can
> use the disassemble function to disassemble emacs byte-code.
>

I have looked at some header and C files on the savannah site, not this one.

I am waiting for a reply from the group and RMS on the earliest
sources which were probably smaller also, like 13 to 16.56 which might
be simpler for this newbie.

Perhaps, you may put a snippet to actually show a few things to this newbie.

I think often its best to demonstrate then to direct particularly for
those who say its easy for them.

What type of scanner does the Lisp parser and interpreter use ? Is it
listed ? Is there a FSM state transition table drawn ?

Franz Xe



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: What's the spec for emacs lisp virtual machine ?
  2010-07-23 15:59   ` Fren Zeee
  2010-07-23 16:01     ` Fren Zeee
@ 2010-07-23 16:40     ` Pascal J. Bourguignon
  1 sibling, 0 replies; 18+ messages in thread
From: Pascal J. Bourguignon @ 2010-07-23 16:40 UTC (permalink / raw
  To: help-gnu-emacs

Fren Zeee <frenzeee@gmail.com> writes:

>
> unfortunately, this reply did not give any benefit and info repeated
> before. the reply did not even put a snippet of the code from c file
> to illustrate how he himself read and understood it. someone else try
> if anyone knows.

LOL!

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: What's the spec for emacs lisp virtual machine ?
  2010-07-23 16:03       ` Fren Zeee
@ 2010-07-23 16:41         ` Pascal J. Bourguignon
  2010-07-23 17:57         ` Barry Margolin
  1 sibling, 0 replies; 18+ messages in thread
From: Pascal J. Bourguignon @ 2010-07-23 16:41 UTC (permalink / raw
  To: help-gnu-emacs

Fren Zeee <frenzeee@gmail.com> writes:
> portability does not require VM, it only requires C while emacs
> interprets the lisp code. a diff command in C is portable over
> computers because its written in C. not because of a VM.

C is a VM.

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: What's the spec for emacs lisp virtual machine ?
  2010-07-23 16:18   ` Fren Zeee
@ 2010-07-23 17:13     ` Chong Yidong
  0 siblings, 0 replies; 18+ messages in thread
From: Chong Yidong @ 2010-07-23 17:13 UTC (permalink / raw
  To: Fren Zeee; +Cc: ams, emacs-devel

Fren Zeee <frenzeee@gmail.com> writes:

> I have looked at some header and C files on the savannah site, not this one.
>
> I am waiting for a reply from the group and RMS on the earliest
> sources which were probably smaller also, like 13 to 16.56 which might
> be simpler for this newbie.
>
> What type of scanner does the Lisp parser and interpreter use ? Is it
> listed ? Is there a FSM state transition table drawn ?

From Emacs, do

  `C-h f read'
  `C-h f eval'

and follow the sources.  I don't think it's profitable to look at early
versions of Emacs; that's a wild goose chase.  The fact that the sources
are bigger now than in earlier versions is irrelevant, if you're only
going to be looking at the Lisp reader and interpreter.



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: What's the spec for emacs lisp virtual machine ?
  2010-07-23 16:03       ` Fren Zeee
  2010-07-23 16:41         ` Pascal J. Bourguignon
@ 2010-07-23 17:57         ` Barry Margolin
  1 sibling, 0 replies; 18+ messages in thread
From: Barry Margolin @ 2010-07-23 17:57 UTC (permalink / raw
  To: help-gnu-emacs

In article 
<61a26ed5-80eb-4175-b7c4-162a1ce21a59@e5g2000yqn.googlegroups.com>,
 Fren Zeee <frenzeee@gmail.com> wrote:

> portability does not require VM, it only requires C while emacs
> interprets the lisp code. a diff command in C is portable over
> computers because its written in C. not because of a VM.

An interpreter *is* a VM.  The "machine language" of this VM is the 
language being interpreted.

Maybe what you're really asking is whether we need byte code?  That's 
just an optimization.  Compiling to machine code is even more of an 
optimization, but then the result is not portable.  So a byte code VM is 
a compromise between source code interpretation and machine code 
compilation.

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: What's the spec for emacs lisp virtual machine ?
  2010-07-23  6:12 Fren Zeee
  2010-07-23  8:34 ` Pascal J. Bourguignon
@ 2010-07-30  3:51 ` mdj
  2010-07-30  5:01   ` Fren Zeee
  1 sibling, 1 reply; 18+ messages in thread
From: mdj @ 2010-07-30  3:51 UTC (permalink / raw
  To: help-gnu-emacs

On Jul 23, 4:12 pm, Fren Zeee <frenz...@gmail.com> wrote:
> Why is a VM needed when there is compiled C code running machine
> code ?

The are two essential reasons. Firstly, the bytecode is more compact
in memory than either the machine code or the READ lisp code.
Secondly, it loads a good deal faster from disk, allowing emacs to
start (relatively) quickly.

Thirdly, it is relatively straightforward to implement a portable
bytecode interpreter in C that will then compile on any architecture
for which one has a C compiler. This is a great deal less work than
developing a 'to-machine-code' compiler for every architecture out
there.

Keep in mind that the early releases of GNU Emacs were in the mid
1980's when personal computers powerful enough to run Emacs had
typically perhaps 1mb of RAM. Keeping the in-memory footprint of Emacs
small was more important than raw speed which would need more RAM, and
necessitate customizer the code generator for every conceivable
architecture.

In 1989 there were a LOT of 32bit microprocessor architectures out
there, and many still survive to this day.

To answer the rest of your questions, I'd recommend enrolling in a
good computer science degree.

Matt


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: What's the spec for emacs lisp virtual machine ?
  2010-07-30  3:51 ` mdj
@ 2010-07-30  5:01   ` Fren Zeee
  2010-07-30  5:28     ` mdj
  2010-08-02 19:35     ` Barry Margolin
  0 siblings, 2 replies; 18+ messages in thread
From: Fren Zeee @ 2010-07-30  5:01 UTC (permalink / raw
  To: help-gnu-emacs

On Jul 29, 8:51 pm, mdj <mdj....@gmail.com> wrote:
> On Jul 23, 4:12 pm, Fren Zeee <frenz...@gmail.com> wrote:
>
> > Why is a VM needed when there is compiled C code running machine
> > code ?
>
> The are two essential reasons. Firstly, the bytecode is more compact
> in memory than either the machine code or the READ lisp code.
> Secondly, it loads a good deal faster from disk, allowing emacs to
> start (relatively) quickly.

an example

preferably from an emacs file from savannah link so one could get an
idea of the animal.

theoretical reasons for speed ?

> Thirdly, it is relatively straightforward to implement a portable
> bytecode interpreter in C that will then compile on any architecture
> for which one has a C compiler. This is a great deal less work than
> developing a 'to-machine-code' compiler for every architecture out
> there.

Why is it less than porting the C compiler ? How would it be written ?
assembler ?

> Keep in mind that the early releases of GNU Emacs were in the mid
> 1980's when personal computers powerful enough to run Emacs had
> typically perhaps 1mb of RAM. Keeping the in-memory footprint of Emacs
> small was more important than raw speed which would need more RAM, and
> necessitate customizer the code generator for every conceivable
> architecture.


> In 1989 there were a LOT of 32bit microprocessor architectures out
> there, and many still survive to this day.

> To answer the rest of your questions, I'd recommend enrolling in a
> good computer science degree.

I am sure someone can point to a tutorial paper or book,

no one need you to give that obvious advice ... so obvious that i
consider rude

> Matt



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: What's the spec for emacs lisp virtual machine ?
  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
  1 sibling, 1 reply; 18+ messages in thread
From: mdj @ 2010-07-30  5:28 UTC (permalink / raw
  To: help-gnu-emacs

On Jul 30, 3:01 pm, Fren Zeee <frenz...@gmail.com> wrote:
> On Jul 29, 8:51 pm, mdj <mdj....@gmail.com> wrote:
>
> > On Jul 23, 4:12 pm, Fren Zeee <frenz...@gmail.com> wrote:
>
> > > Why is a VM needed when there is compiled C code running machine
> > > code ?
>
> > The are two essential reasons. Firstly, the bytecode is more compact
> > in memory than either the machine code or the READ lisp code.
> > Secondly, it loads a good deal faster from disk, allowing emacs to
> > start (relatively) quickly.
>
> an example
>
> preferably from an emacs file from savannah link so one could get an
> idea of the animal.

Any emacs lisp source file will serve as an example.

> theoretical reasons for speed ?

bytecode is simpler to parse, and more compact in its representation
than s-expressions represented as cons cells.

> > Thirdly, it is relatively straightforward to implement a portable
> > bytecode interpreter in C that will then compile on any architecture
> > for which one has a C compiler. This is a great deal less work than
> > developing a 'to-machine-code' compiler for every architecture out
> > there.
>
> Why is it less than porting the C compiler ? How would it be written ?
> assembler ?

Are you suggesting the emacs lisp compiler could target C instead of
bytecode?

> > Keep in mind that the early releases of GNU Emacs were in the mid
> > 1980's when personal computers powerful enough to run Emacs had
> > typically perhaps 1mb of RAM. Keeping the in-memory footprint of Emacs
> > small was more important than raw speed which would need more RAM, and
> > necessitate customizer the code generator for every conceivable
> > architecture.
> > In 1989 there were a LOT of 32bit microprocessor architectures out
> > there, and many still survive to this day.
> > To answer the rest of your questions, I'd recommend enrolling in a
> > good computer science degree.
>
> I am sure someone can point to a tutorial paper or book,
>
> no one need you to give that obvious advice ... so obvious that i
> consider rude

Okay, but your relatively poor command of english is making you appear
very rude as well. Perhaps consider using more words to describe what
you mean. The odd gratuity like 'please' and 'thanks' would do wonders
for your style.




^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: What's the spec for emacs lisp virtual machine ?
  2010-07-30  5:28     ` mdj
@ 2010-07-30  5:41       ` Fren Zeee
  0 siblings, 0 replies; 18+ messages in thread
From: Fren Zeee @ 2010-07-30  5:41 UTC (permalink / raw
  To: help-gnu-emacs

On Jul 29, 10:28 pm, mdj <mdj....@gmail.com> wrote:
> On Jul 30, 3:01 pm, Fren Zeee <frenz...@gmail.com> wrote:
>
>
>
>
>
> > On Jul 29, 8:51 pm, mdj <mdj....@gmail.com> wrote:
>
> > > On Jul 23, 4:12 pm, Fren Zeee <frenz...@gmail.com> wrote:
>
> > > > Why is a VM needed when there is compiled C code running machine
> > > > code ?
>
> > > The are two essential reasons. Firstly, the bytecode is more compact
> > > in memory than either the machine code or the READ lisp code.
> > > Secondly, it loads a good deal faster from disk, allowing emacs to
> > > start (relatively) quickly.
>
> > an example
>
> > preferably from an emacs file from savannah link so one could get an
> > idea of the animal.
>
> Any emacs lisp source file will serve as an example.
>
> > theoretical reasons for speed ?
>
> bytecode is simpler to parse, and more compact in its representation
> than s-expressions represented as cons cells.
>
> > > Thirdly, it is relatively straightforward to implement a portable
> > > bytecode interpreter in C that will then compile on any architecture
> > > for which one has a C compiler. This is a great deal less work than
> > > developing a 'to-machine-code' compiler for every architecture out
> > > there.
>
> > Why is it less than porting the C compiler ? How would it be written ?
> > assembler ?
>
> Are you suggesting the emacs lisp compiler could target C instead of
> bytecode?
>
> > > Keep in mind that the early releases of GNU Emacs were in the mid
> > > 1980's when personal computers powerful enough to run Emacs had
> > > typically perhaps 1mb of RAM. Keeping the in-memory footprint of Emacs
> > > small was more important than raw speed which would need more RAM, and
> > > necessitate customizer the code generator for every conceivable
> > > architecture.
> > > In 1989 there were a LOT of 32bit microprocessor architectures out
> > > there, and many still survive to this day.
> > > To answer the rest of your questions, I'd recommend enrolling in a
> > > good computer science degree.
>
> > I am sure someone can point to a tutorial paper or book,
>
> > no one need you to give that obvious advice ... so obvious that i
> > consider rude


> Okay, but your relatively poor command of english is making you appear
> very rude as well. Perhaps consider using more words to describe what
> you mean. The odd gratuity like 'please' and 'thanks' would do wonders
> for your style.- Hide quoted text -

If you had given a concrete example, it would have come out
automatically.

There are two pre-requisites for giving such a useful clear reply. One
is
technical competence, and another is generosity.

Its obvious that you lack one or the other so I wont get into an
argument with you.



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: What's the spec for emacs lisp virtual machine ?
  2010-07-30  5:01   ` Fren Zeee
  2010-07-30  5:28     ` mdj
@ 2010-08-02 19:35     ` Barry Margolin
  1 sibling, 0 replies; 18+ messages in thread
From: Barry Margolin @ 2010-08-02 19:35 UTC (permalink / raw
  To: help-gnu-emacs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 983 bytes --]

In article 
<80cc90dc-d66b-4d93-9ff9-dccacec01770@c10g2000yqi.googlegroups.com>,
 Fren Zeee <frenzeee@gmail.com> wrote:

> On Jul 29, 8:51 pm, mdj <mdj....@gmail.com> wrote:
> > Thirdly, it is relatively straightforward to implement a portable
> > bytecode interpreter in C that will then compile on any architecture
> > for which one has a C compiler. This is a great deal less work than
> > developing a 'to-machine-code' compiler for every architecture out
> > there.
> 
> Why is it less than porting the C compiler ? How would it be written ?
> assembler ?

It isn't less, it's very similar.  But since someone has already done 
the C compiler, you don't need to do it at all.  You can simply write a 
byte-code interpreter once, and it will run on all the machines that 
have C compilers.

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2010-08-02 19:35 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-23  6:15 What's the spec for emacs lisp virtual machine ? 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
  -- strict thread matches above, loose matches on Subject: below --
2010-07-23  6:12 Fren Zeee
2010-07-23  8:34 ` Pascal J. Bourguignon
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

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.