~/talk

Writing an Interpreter in SQL for Fun and No Profit!

Talkat !!Con 2019 · 2019-06-01..06-03· [databases]
links:none on file
slides:none on file

Claims a working Lisp-like interpreter implemented entirely in Postgres SQL using JSON for the AST and recursive CTEs plus CASE to emulate a stack and control flow. Implements a calculator, arithmetic and comparison ops, list primitives, if, lambdas with environments and a self-pass trick for recursion. The full implementation fits about 100 lines of SQL and successfully computes examples — e.g. returns 37 for a small program and generates the first 10 Fibonacci numbers.

AI-written summary · about

  1. 0:00Intro
  2. 0:32Lisp is a great place to start!
  3. 1:37Evaluating an Expression
  4. 1:54An Example
  5. 3:33Sketch of How the Interpreter Will Work
  6. 4:04Basic State Manipulations
  7. 4:40Interpreter Skeleton
  8. 5:09The CASE Statement Does All The Work
  9. 5:24Self-Evaluating Expressions
  10. 5:34Function Calls
  11. 5:47Second Case: Argument Evaluation Stack Frames
  12. 6:04Recursive Case: Evaluate one argument
  13. 6:29Last Stack Frame: Eval Call Frames
  14. 6:42Terminating Condition of the Interpreter
  15. 7:24Example: Fibonacci Numbers
  16. 8:09Implementation
  17. 8:26One Last Feature: Lambda Functions
  18. 8:43Variables
  19. 9:24Define a lambda function
  20. 9:43Calling a Lambda Function
  21. 10:14Example: First 10 Fibonacci Numbers
  22. 10:43Actual Logic
  23. 11:11Full Code
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.