Subject: Re: Examples of (Common) Lisp/Scheme code which interfaces with the bare metal ?
From: rpw3@rpw3.org (Rob Warnock)
Date: Thu, 04 Jun 2009 21:13:33 -0500
Newsgroups: comp.lang.lisp
Message-ID: <yt6dnanGP5zQ4rXXnZ2dnUVZ_jWdnZ2d@speakeasy.net>
jurgen_defurne  <jurgen.defurne@pandora.be> wrote:
+---------------
| As a hobby project, I am designing a 32-bit processor which I am
| simulating using Common Lisp (mostly based upon SIMH ideas). Currently
| I have a working simulation of a simple load/store instruction set, an
| assembler and some simple test programs.
+---------------

Neat!

+---------------
| However, I want to go further. Last fall I implemented a simple Lisp
| interpreter in Perl and now I want to implement a simple Lisp
| interpreter on my simulated machine. However, I would like to
| start with a Lisp description of all my necessary code and in order to
| do that I would like to know if there are somewhere examples and
| implementations of (Common) Lisp/Scheme code which
| deal with structures in the C sense of the word (contiguous blocks of
| memory with fields which are just offsets in the block) ?
+---------------

Please say a little more about exactly what you mean by "deal with
structures". Almost all Lisp/Scheme compilers/interpreters have some
sort of simple "deref+offset" operators down at the bottom of their
implementations. E.g., DEFSTRUCT accessors might be defined as closures
over a more primitive operator such as (an internal version of) ELT,
perhaps.

Also, in terms of generating code for a "raw" machine, make sure you've
read the chapters on compilation in both SICP <http://mitpress.mit.edu/sicp/>
and L.i.S.P. <http://www-spi.lip6.fr/~queinnec/WWW/LiSP.html> [and maybe
even the bits on compiling in PAIP <http://www.norvig.com/paip.html>].


-Rob

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607