Add examples with cargo run --example support

- Move .mrs files into misses-compiler/examples/ alongside .rs runners
- Add lib.rs exposing parse/codegen for use by example binaries and main.rs
- Fix parser: #[attr] vs #[a => b] disambiguation (look for => before ])
- Fix parser: `for` keyword in `impl Foo for Bar` no longer triggers spread
  (is_spread_for lookahead: must match `for <ident> in $<ident> =>`)
- Add derive_getters.mrs: getter methods via spread iteration
- Add make_id_type.mrs: newtype u64 wrapper with From impls, derive attrs

Run with: cargo run --example hello|derive_builder|declare_table|derive_getters|make_id_type

https://claude.ai/code/session_01Tppkab4eLsL21asHGjQJoF
This commit is contained in:
Claude
2026-03-07 15:35:01 +00:00
parent ed62264870
commit f90953a3bb
14 changed files with 213 additions and 21 deletions
+2 -6
View File
@@ -1,7 +1,3 @@
mod ast;
mod parser;
mod codegen;
use std::path::PathBuf;
fn main() {
@@ -20,7 +16,7 @@ fn main() {
}
};
let ast = match parser::parse(&src) {
let ast = match misses::parse(&src) {
Ok(a) => a,
Err(e) => {
eprintln!("Parse error: {}", e);
@@ -28,7 +24,7 @@ fn main() {
}
};
let generated = codegen::codegen(&ast);
let generated = misses::codegen(&ast);
if args.len() >= 3 {
let output_path = PathBuf::from(&args[2]);