Building a Programming Language in Swift
summary
Builds a minimal HTML templating language in Swift that actually parses and evaluates code into HTML showing strings, integers, variables, nested tags, function values and calls, and let bindings and it works end to end. Parser uses recursive functions over Substring slices for performance and comma separated arg lists, AST is an indirect enum, evaluator uses a context map to resolve variables and create nested scopes, errors carry positions by annotating the AST with source ranges via a generic wrapper and the implementation escapes strings when embedding into tags and is ready for adding a type checker or recovery.
AI-written summary · about
chapters (5)
related talks
27mAST Meta-programming
38mCompilers aren’t magic, so let’s build one in Swift
45mHow to Make a Programming Language
46mInventing a language (placeholder title)
06mLightning Talk: Improving an HTML Parser with Swift 6 Pattern Matching
33mMaking Your Own Tools Using SwiftSyntax
38mType-safe meta programming in Swift? Lets talk about Sourcery.
27mSwiftSyntax: for good and evil
