roam-macros-parse 0.6.0

Parser grammar for roam RPC service trait definitions
Documentation

Parser grammar for roam RPC service trait definitions.

This Is Just a Grammar

This crate contains only the unsynn grammar for parsing Rust trait definitions that define roam RPC services. It does not:

  • Generate any code
  • Perform validation
  • Know anything about roam's wire protocol
  • Have opinions about how services should be implemented

It simply parses syntax like:

pub trait Calculator {
    /// Add two numbers.
    async fn add(&self, a: i32, b: i32) -> i32;
}

...and produces an AST ([ServiceTrait]) that downstream crates can inspect.

Why a Separate Crate?

The grammar is extracted into its own crate so that:

  1. It can be tested independently — We use datatest-stable + insta for snapshot testing the parsed AST, which isn't possible in a proc-macro crate.

  2. It's reusable — Other tools (linters, documentation generators, IDE plugins) can parse service definitions without pulling in proc-macro dependencies.

  3. Separation of concerns — The grammar is pure parsing; roam-macros handles the proc-macro machinery; roam-codegen handles actual code generation.

The Bigger Picture

roam-macros-parse     roam-macros              roam-codegen
┌──────────────┐     ┌──────────────┐         ┌──────────────┐
│              │     │              │         │              │
│  unsynn      │────▶│  #[service]  │────────▶│  build.rs    │
│  grammar     │     │  proc macro  │         │  code gen    │
│              │     │              │         │              │
└──────────────┘     └──────────────┘         └──────────────┘
   just parsing         emit metadata          Rust, TS, Go...