AST Meta-programming
summary
Shows how to read and modify Swift ASTs and uses three concrete formats: SourceKitten JSON, SwiftSyntax, and dump AST. Builds a token-based syntax highlighter that wraps tokens in span tags and fixes tree structure with visitor pre/post hooks. Ships an online SwiftSC Explorer playground. Implements an AOP tool that intercepts the build, injects print statements into methods whose names start with "view", recompiles, launches the simulator, and confirms logs appear. Implements an assertion converter that uses dump AST type info to capture argument values.
AI-written summary · about
chapters (13)
- 0:00Intro
- 0:42What is AST
- 1:21AST
- 2:00Metaprogramming
- 3:53SauceKit
- 11:44Demo
- 13:33Practical Example
- 14:49Automation
- 15:38Demonstration
- 19:40Diagrammed assertions
- 20:13Dump AST
- 23:59Online Playground
- 25:06Wrap up
related talks
33mMaking Your Own Tools Using SwiftSyntax
22mImproving Swift Tools with libSyntax
38mType-safe meta programming in Swift? Lets talk about Sourcery.
21mUnlock the Potential of Swift Code Generation
27mSwiftSyntax: for good and evil
28mSwiftly Swift manipulation... with Swift
29mMy Little Parser: Tooling is Magic
44mJavaScript AST programming: Introduction and beyond
