Code Generation For Everyone and Everywhere
summary
Code generation uses Typescript/Node.js and Langium to replace plain ES6 templates with composable generator nodes that carry indentation, newline if-not-empty semantics, and annotations instead of raw strings. A tagged-template-like API produces an intermediate object, a second toString step emits formatted text with configurable indentation, and a tracing pass emits source maps so generated code debugs back to DSL source in the browser. Live demos build, run, and debug generated code successfully and the implementation is open source.
AI-written summary · about
chapters (9)
- 0:00Introduction to code generation
- 1:39Limitations of string templates
- 7:19Tagged templates and runtime
- 14:03Abstract generator nodes
- 17:26Smart indentation and formatting
- 22:47Tracing and annotation
- 25:43Practical applications
- 29:28Front-end and debugging demo
- 33:25Advanced debugging and conclusion
related talks
37mThings I learned after a decade of writing code generators
51mGenerate You Some Code for Great Good
52mCode that writes code - .NET Source generators
42mBecoming the Metaprogrammer Real World Code Generation
30mWrite Less (Code), Generate More
55mCode that writes code - .NET Source generators
24mNX Generators or how to skip boring tasks
36mGenerating code in Go
