* write a PostScript interpreter in PostScript * extend it into a single stepping debugger * change the interpreter into an extensible compiler ** register functions and ways to compile them with the compiler ** type of objects to be executed is checked at compile time, and type-specific code is compiled to execute the object ** push literals ** compile PostScript primatives into calls to internal subroutines ** recognize where optimizations can be made *** if, ifelse, loop, repeat, for, forall, case **** threaded code, with branches **** C code, with loops or gotos *** compile inline code for simple primatives ** compiler knows about stack inputs and outputs of functions *** spot invarients and make optimizations **** common cliches: "exch def", "/lit lit def" **** stack manipulation: "1 index", "4 2 roll", "pop pop pop pop" **** math: "5 add 2 div 9 mul" **** calls with constant arguments: "10 dict", "20 string" ** handle tough cases by calling the interpreter ** tail recursion