From: Fren Zeee on
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.
From: Pascal J. Bourguignon on
Fren Zeee <frenzeee(a)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/
From: Fren Zeee on
On Jul 23, 1:34 am, p...(a)informatimago.com (Pascal J. Bourguignon)
wrote:
> Fren Zeee <frenz...(a)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.
From: Fren Zeee on
On Jul 23, 8:59 am, Fren Zeee <frenz...(a)gmail.com> wrote:
> On Jul 23, 1:34 am, p...(a)informatimago.com (Pascal J. Bourguignon)
> wrote:
>
>
>
> > Fren Zeee <frenz...(a)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.
From: Fren Zeee on
On Jul 23, 9:01 am, Fren Zeee <frenz...(a)gmail.com> wrote:
> On Jul 23, 8:59 am, Fren Zeee <frenz...(a)gmail.com> wrote:
>
>
>
> > On Jul 23, 1:34 am, p...(a)informatimago.com (Pascal J. Bourguignon)
> > wrote:
>
> > > Fren Zeee <frenz...(a)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.