The Monad language. Dependent types, functional programming compiled with LLVM. Hobby project. monad-lang.org
dependent-types language compiler programming-language functional-programming

feat: Decl-level macro expansion (Phase 8) master

Adds decl-level macro expansion enabling macros that generate declarations: New Decl variants (no new Term variants): - DeclGen(DeclGenDef) — defmacro name params := decls { ... } - MacroCall { name, args } — top-level name! args before expansion - Generated(Vec<Decl>) — transparent wrapper for expanded declarations Parser changes: - defmacro now accepts decls { ... } body (parallel to existing quote { ... }) - Macro calls at top level: name! arg1 arg2 ... - Uses single_term for macro args to avoid greedy application parsing - peek-based early check prevents partial identifier consumption Expansion logic: - Multi-pass expansion: MacroCall → lookup DeclGen → substitute params → Generated - subst_decl_var helper for declaration template substitution - Generated is flattened transparently Pipeline changes: - elaborate_decl, type_check_decl, module(), and load_decl all handle the new variants (Generated is flattened at each stage) Tests: 4 new tests pass (decl gen basic, with params, simple, define_getter) Total: 174 passing, 1 ignored (pre-existing type position test) No compiler warnings.