I apologize in advance for all of you that already know this, but I
thought many of you would find the following interesting. I was
looking through the source files for GCC and the back-end description
language is basically lisp. Check out the machine description files
(.md). Kind of cool.
Does anyone have any more information about the history of this?
Mike
skibud2 wrote:
> I apologize in advance for all of you that already know this, but I
> thought many of you would find the following interesting. I was
> looking through the source files for GCC and the back-end description
> language is basically lisp. Check out the machine description files
> (.md). Kind of cool.
>
> Does anyone have any more information about the history of this?
>
> Mike
The RTL technology (register-transfer language) comes from brilliant
compiler research done by Fraser and Davidson (a number of papers published
in ACM Toplas)
http://en.wikipedia.org/wiki/Register_Transfer_Language
The lisp-y macros are due to Stallman.
pt
skibud2 wrote:
> I apologize in advance for all of you that already know this, but I
> thought many of you would find the following interesting. I was
> looking through the source files for GCC and the back-end description
> language is basically lisp. Check out the machine description files
> (.md). Kind of cool.
>
> Does anyone have any more information about the history of this?
Lots of compilers generate Lisp-like languages. OCaml is another. Run the
top-level with:
$ ocaml -dlambda
Objective Caml version 3.10.0
#
and it prints out lambda trees as s-exprs for each OCaml definition:
# let rec d e x = match e with
| `Int _ -> `Int 0
| `Add(f, g) -> `Add(d f x, d g x)
| `Mul(f, g) -> `Add(`Mul(f, d g x), `Mul(g, d f x))
| `Var v -> `Int (if v=x then 1 else 0);;
(letrec
(d/68
(function e/69 x/70
(let (variant/79 (field 0 e/69))
(if (>= variant/79 3855332)
(if (>= variant/79 4298439)
(makeblock 0 3654863 (if (caml_equal (field 1 e/69) x/70) 1 0))
(let
(match/78 (field 1 e/69)
g/74 (field 1 match/78)
f/73 (field 0 match/78))
(makeblock 0 3254785
(makeblock 0
(makeblock 0 3855332
(makeblock 0 f/73 (apply d/68 g/74 x/70)))
(makeblock 0 3855332
(makeblock 0 g/74 (apply d/68 f/73 x/70)))))))
(if (>= variant/79 3654863) [0: 3654863 0]
(let (match/77 (field 1 e/69))
(makeblock 0 3254785
(makeblock 0 (apply d/68 (field 0 match/77) x/70)
(apply d/68 (field 1 match/77) x/70)))))))))
(apply (field 1 (global Toploop!)) "d" d/68))
--
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/products/?u