Rust bindings for the K Framework: a KORE pattern parser/serializer and FFI wrappers for the KLLVM execution backend.
Parses and manipulates KORE (K's intermediate representation) in pure Rust, with no native dependencies.
- Lexer and parser for textual KORE patterns, sorts, sentences, and definitions
- Full AST for KORE (
Pattern,Sort,App,Sentence,Definition, ...) - JSON serialization and deserialization via
serde PatternVisitortrait for custom traversalskore-to-jsonbinary: reads a.korefile and prints JSON to stdout
Rust wrappers around the KLLVM C API (interpreter.so). Lets you execute K semantics compiled with kompile --llvm-kompile-type c from Rust.
Pattern: owns akore_pattern *; parse from a KORE string or build from aSymbolBlock: wraps KLLVM's interned term representation; runs execution viatake_stepsSort/Symbol: RAII wrappers withDropimplementationsMarshaller<H>: converts akore::Patterntree to kllvm, substituting typed variables through a user-suppliedVarHandler; caches variable-free subtrees across calls
- Rust 1.85.0+
libclang(kframework_ffionly)- A
kompile-builtinterpreter.soonLD_LIBRARY_PATH(kframework_ffionly)
# Build the pure-Rust kframework crate only
cargo build -p kframework
# Build everything (requires interpreter.so)
cargo buildcargo testcargo fmt
cargo clippy --all-targets -- --deny warningsOr run all checks at once:
makeuse kframework::kore::Parser;
let mut parser = Parser::new(r#"\dv{SortInt{}}("42")"#)?;
let pattern = parser.pattern()?;
println!("{:?}", pattern);cargo run --bin kore-to-json -- path/to/file.koreuse kframework_ffi::kllvm;
kllvm::init();
let pattern: kllvm::Pattern = KORE_STRING.parse().expect("parse failed");
let mut block: kllvm::Block = pattern.into();
block.take_steps(-1); // run to completion
let result: kllvm::Pattern = block.into();
println!("{result}");
kllvm::free_all_memory();See kframework_ffi/src/kllvm.rs for the full API.
Uses kframework_ffi with honggfuzz to fuzz K semantics compiled from the bundled Imp language definition.
See examples/fuzzer/README.md for setup instructions.
BSD 3-Clause. Copyright (c) 2024-2026 Runtime Verification Inc. See LICENSE for details.