~/talk

Writing a Compiler in Node.js using Streams

Talkat OpenJS World 2022 · 2022-06-06..06-10· [nodejs, compilers-and-language-design]
links:none on file
slides:none on file

Claim: a usable toy compiler is practical to build in Node.js by wiring lexer, parser and codegen as transform streams that pass JS objects in objectMode. Implementation tokenizes with a small preprocessor and a second token stage, parses with a top‑down parser that emits a Babel AST, then generates JavaScript. Tests include fizzbuzz (works) and fibonacci (iteration runs but missed the zero). Local Node diagnostics reveal buffering and backpressure behavior.

AI-written summary · about

  1. 0:00Start
  2. 1:34Why write a compiler
  3. 2:23What are compilers
  4. 3:31Compiler Layers
  5. 6:50Node.js Core Streams
  6. 10:53Compiler Parts
  7. 11:35Grammar
  8. 12:22Lexer
  9. 13:42Parser
  10. 15:44Code Generation
  11. 16:57FizzBuzz
  12. 17:24Fibonacci
  13. 18:02Streams!
~/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.