sim-lib-pattern 0.1.4

Shape-based pattern matching and destructuring for SIM runtime values.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//! Dialect compiler seam for text-pattern syntaxes.

use sim_kernel::Result;

use crate::TextOp;

/// A surface pattern syntax that compiles to the shared text-pattern VM.
pub trait PatternDialect: Send + Sync {
    /// Compiles `pattern` into VM operations.
    ///
    /// # Errors
    ///
    /// Returns an error when the surface pattern is malformed.
    fn compile(&self, pattern: &str) -> Result<Vec<TextOp>>;
}