Compilers
summary
A tiny “matrix language” (scalars, row/col vectors, matrices, transpose, +, *) is specified, lexed and parsed using the Jison parser generator, and given a small runtime that implements print, addition, multiplication and transpose. The system produces both an interpreter and a straightforward compiler that emits JavaScript functions; the compiled code runs in Node or the browser, and compilation currently costs roughly 10× the raw execution time.
AI-written summary · about
chapters (21)
- 0:00Introduction
- 1:10Creating new languages
- 3:17Matrix language
- 4:41Matrix syntax
- 7:07Compiler tools
- 8:12Lexer rules
- 10:22Grammar rules
- 14:17BNF structure
- 15:19Operator grammar
- 16:22Expression parsing
- 17:25Matrix recursion
- 18:06Operator priorities
- 19:10Grammar testing
- 19:31Runtime environment
- 20:13Interpreter rules
- 21:39Matrix in code
- 22:44Writing compiler
- 23:46Compiler vs interpreter
- 25:56Compiler steps
- 26:38JavaScript parsers
- 27:01Q&A
