10 Commits
Author SHA1 Message Date
Markk116 5fd49ab913 add license 2026-05-26 23:31:18 +02:00
Markk116 f40fa795eb update readme, set add nix shell 2026-03-08 13:42:07 +01:00
Markk116andGitHub 22cde2b988 Merge pull request #2 from Markk116/claude/fix-todos-stubs-t4TEN
Replace .unwrap() with proper proc macro error handling in codegen
2026-03-08 10:43:15 +01:00
Claude a86ba9760c Update README with misses init docs and error handling note
- Rewrite Quick start to show `cargo install misses` and the new
  `misses init` subcommand as the primary entry point
- Add a dedicated `misses init` section explaining binary mode
  (build-time codegen via OUT_DIR, nothing committed) and library
  mode (--lib: generated/ committed, misses-source feature to
  rebuild, zero misses dependency for downstream users)
- Update project layout to include init.rs
- Add note that parse errors surface as compiler diagnostics via
  into_compile_error() rather than panicking

https://claude.ai/code/session_01D2g6zGJsBeUEzxBb7AvFDt
2026-03-08 09:34:43 +00:00
Claude 3be88ec21f Add misses init command with binary and library scaffold modes
`misses init [--lib] [dir]` scaffolds a new proc-macro crate that uses
misses as its build toolchain. Two modes are supported:

Binary mode (default):
  The .mrs source files live in src/macros/ and are compiled to
  $OUT_DIR at build time via a generated build.rs. The generated
  Rust code is never committed — users must have misses installed
  to build from source.

Library mode (--lib):
  The generated code is committed to generated/ so downstream users
  of the crate need no misses install at all. The .mrs source and
  build.rs are still present for the library author, who can
  regenerate via `cargo build --features misses-source`. The
  misses-source feature makes misses an optional build-dependency
  and gates the regeneration path in build.rs with #[cfg(feature)].

The command also teaches `main.rs` a proper subcommand dispatch so
that `misses <file.mrs>` (compile) and `misses init` are cleanly
separated.

https://claude.ai/code/session_01D2g6zGJsBeUEzxBb7AvFDt
2026-03-08 09:30:14 +00:00
Claude 0ac3a473d4 Replace .unwrap() with proper proc macro error handling in codegen
The generated proc macro code was using .unwrap() for parse failures,
causing panics instead of emitting proper Rust compile errors. Replace
both unwrap calls with match expressions that call
e.into_compile_error().into() to surface parse failures as compiler
diagnostics in the generated proc macros.

https://claude.ai/code/session_01D2g6zGJsBeUEzxBb7AvFDt
2026-03-08 09:11:41 +00:00
Claude 36c85500bd Add unit tests for parser and codegen
29 tests covering:
- Parser: binding kinds, variadic patterns, literal tokens, ident
  constructs, spread-for detection, escape/template output blocks,
  multi-macro files, comment skipping, error reporting (line/col)
- Codegen: proc_macro fn emission, single/structural/variadic patterns,
  escape blocks, ident construction, keyword vs non-keyword tokens,
  and round-trip tests for the hello and derive_getters examples

https://claude.ai/code/session_01Tppkab4eLsL21asHGjQJoF
2026-03-07 23:36:18 +00:00
Claude e8d835e196 Add misses-rt crate, component example, README, and fix codegen for non-keyword literal tokens
- misses-rt: add Buffer/Markup HTML helpers, name/type helpers, parse_sections/parse_kv, and template AST
- codegen: add is_syn_keyword() — non-keyword idents in patterns now generate parse+compare instead of syn::Token![…]
- parser: split punct vs ident chars in literal pattern tokens so `props:` becomes two tokens
- examples: add component.mrs/.rs demonstrating named literal tokens and tt capture
- README: comprehensive guide covering .mrs syntax, running the compiler, misses-rt helpers, and examples

https://claude.ai/code/session_01Tppkab4eLsL21asHGjQJoF
2026-03-07 19:23:53 +00:00
Claude f90953a3bb 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
2026-03-07 15:35:01 +00:00
Claude ed62264870 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
2026-03-07 11:37:58 +00:00