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
@@ -0,0 +1,13 @@
// derive_getters.mrs — auto-generate getter methods
// Demonstrates: struct pattern, variadic binding, spread iteration generating
// impl methods with reference return types
macro derive_getters! {
struct $name:ident { $($field:ident : $ty:ty),* } => {
T~{
impl $name {
for field in $fields =>
pub fn $field.name(&self) -> &$field.ty { &self.$field.name }
}
}
}
}