memo

"Compiler Construction Using Scheme" http://www.cs.indiana.edu/~dyb/pubs/fple95.pdf こんなの見つけた。

"Compiler Construction Using Scheme" より。

(let ((f (lambda (x) 
 (let ((y (+ x 1))) 
 (lambda (z) 
 (cons y (cons z (quote (1 2))))))))) 
 ((f 4) 5)) 

中間言語では以下のように書けるらしい。

(let ((t (cons 1 (cons 2 ( ))))) 
 (let ((f (closure (x) ((local t)) 
  (let ((y (+ (bound 0 x ) 1))) 
   (closure (z) ((local y) (free 0 t)) 
   (cons (free 0 y) 
   (cons (bound 0 z) 
   (free 1 t))))))))
 (((local f) 4) 5))) 

中身がまるで分かっていないせいか、なんだか(まさか使っているフォントのせい?)とてもとてもクールに見える。いつか真似しよう。

In this workshop we will present and develop a native-code compiler for the core of Scheme using source-to-source transformations that is suitable for use as the basis for a course in compiler design.

上記2つとも、前にも辿り着いてスルーしてたかも。ようやく反応できるくらいは理解が深まったか?
それでもまだまだ「コンパイラを勉強しています」とさえ言えないくらい入門レベルだなぁ。