94fc6bf56d
This commit introduces support for AST macros and templates, enabling users to define and use custom, reusable components within the visual DSL. Key changes include: - A new `MacroRegistry` to manage macro definitions. - A `MacroExpander` to process macro calls and expand templates. - A `MacroEvaluator` trait for evaluating expressions during expansion. - The `Expansion` node in `BoundKind` to preserve the original macro call and its expanded form for debugging. - Updates to the `Binder`, `Dumper`, and `UpvalueAnalyzer` to handle the new macro constructs. - New examples demonstrating various macro functionalities like `unless`, splicing, and nested macros.
9 lines
193 B
Plaintext
9 lines
193 B
Plaintext
;; Benchmark: 200ns
|
|
;; Macro Splicing example
|
|
;; Demonstrates unrolling a list into another list.
|
|
;; Output: [0 1 2 3 4]
|
|
|
|
(do
|
|
(macro wrap [items] `[0 ~@items 4])
|
|
(wrap [1 2 3]))
|