Implement Misses DSL compiler (parser + codegen)

- ast.rs: Full AST for .mrs files (MacroDef, Pattern, OutputBody, TemplateItem)
- parser.rs: Hand-written recursive descent parser with line/col error reporting
- codegen.rs: Transforms AST to Rust proc macro code using syn/quote/proc_macro2
- main.rs: CLI reads .mrs file, runs parse→codegen, writes to stdout or file
- Cargo.toml: Workspace with syn, quote, proc-macro2, prettyplease deps
- examples/: hello.mrs, derive_builder.mrs, declare_table.mrs reference examples

All three reference examples parse and produce prettyplease-formatted Rust output.
Generated code uses syn::parse::Parser closures for structural patterns, quote!
for token templates, spread iteration via .iter().map().collect(), and
format_ident! for identifier construction.

https://claude.ai/code/session_01Tppkab4eLsL21asHGjQJoF
This commit is contained in:
Claude
2026-03-07 11:37:58 +00:00
commit ed62264870
11 changed files with 1152 additions and 0 deletions
+9
View File
@@ -0,0 +1,9 @@
macro hello! {
$name:ident => {
T~{
pub fn #[say => hello]() -> &'static str {
${ format!("hello, {}!", stringify!(name)) }
}
}
}
}