Implementing a programming language is an experience no programmer should go without; the process fosters a deep understanding of computation, and it's fun! In this article, I've boiled the entire process down to its essence: a 7-line interpreter for a functional (Turing-equivalent) programming language. It takes about 3 minutes to implement. This 7-line interpreter showcases a scalable architecture found in many interpreters--the eval/apply design pattern of Structure and Interpretation of Computer Programs: In total, there are three language implementations in this article: a 7-line, 3-minute interpreter in Scheme; a re-implementation in Racket; and a 100-line, "1-afternoon" interpreter that implements top-level binding forms, explicit recursion, side effects, higher-order functions and more! The last interpreter is a good starting point for growing a richer language.
Comments (0)
Login or Register to apply