Self-directed study in programming language implementation, spanning Haskell, Standard ML, and Scheme.
straightLineLang.sml— Full interpreter for a straight-line programming language: AST definition,maxargsstatic analysis, andinterpStm/interpExpmutually recursive interpreter with mutable environment threading.chap1Exercises.sml— Binary search tree withmember,insert, and avalidfunction implementing "parse, don't validate" via an opaquevalidTreewrapper type.
Lib.hs— Port usingControl.Monad.Statefor environment threading + anattoparsecparser for the straight-line language.LibAlt.hs— Refactored version using a modular monad transformer stack (WriterTfor print output,StateTfor environment,ExceptTfor errors).
Parser.hs—Parsernewtype with manually derivedFunctor,Applicative,Monad, andAlternativeinstances. Basic combinators (char,str,space,digit, etc.).
eopl.scm— Exercises from the first two chapters in Racket's#lang eopl: recursive data structure manipulation, environment representations, binary tree operations, Church-encoded arithmetic (successor, predecessor, plus, times, factorial), and a stack implementation.
- Andrew Appel, Modern Compiler Implementation in ML (Ch. 1)
- Daniel Friedman & Mitchell Wand, Essentials of Programming Languages (Chs. 1–2)