Expand description
Text DSL parser for fabula patterns and graphs.
Inspired by Kreminski et al. (2021) “Winnow: A Domain-Specific Language for Incremental Story Sifting” (AIIDE 2021). Extends Winnow with metric temporal constraints (Dechter/Meiri/Pearl 1991), strict variable scoping validation, and composition operators (Kreminski et al. 2025 FDG).
Provides a human-readable syntax for defining temporal graph patterns and in-memory graphs, compiling them to fabula’s core types.
§Pattern syntax
pattern violation_of_hospitality {
stage e1 {
e1.eventType = "enterTown"
e1.actor -> ?guest
}
stage e2 {
e2.eventType = "showHospitality"
e2.actor -> ?host
e2.target -> ?guest
}
unless between e1 e2 {
eMid.eventType = "leaveTown"
eMid.actor -> ?guest
}
}§Graph syntax
graph {
@1 ev1.eventType = "enterTown"
@1 ev1.actor -> alice
@2..5 ev2.eventType = "siege"
now = 10
}Re-exports§
pub use compiler::compile_pattern_body;pub use compiler::compile_pattern_body_with;pub use compiler::MemMapper;pub use compiler::TypeMapper;
Modules§
- ast
- Abstract syntax tree types for the fabula DSL.
- compiler
- Compiler: AST → fabula Pattern and MemGraph.
- error
- Parse error types with source location tracking.
- lexer
- Tokenizer for the fabula DSL.
- parser
- Recursive descent parser for the fabula DSL.
Structs§
- Parsed
Document - Result of parsing a document with patterns, graphs, and compose directives.
Functions§
- parse_
document - Parse a document using the default
MemMapper. - parse_
document_ with - Parse a document using a custom
TypeMapper. - parse_
graph - Parse a graph DSL string into a
MemGraph. - parse_
pattern - Parse a pattern DSL string into a compiled
Pattern<String, MemValue>. - parse_
pattern_ with - Parse a pattern DSL string using a custom
TypeMapper.