Skip to main content

Module debug

Module debug 

Source
Expand description

Debug display utilities for AST types with interner access.

This module provides the DisplayWith trait for formatting AST types that contain interned symbols. Since symbols are just integer IDs, displaying them requires access to the interner to resolve the actual strings.

Use the .with(interner) method to create a displayable wrapper:

use logicaffeine_base::Interner;
use logicaffeine_language::ast::{LogicExpr, Term};
use logicaffeine_language::debug::DisplayWith;

let mut interner = Interner::new();
let mortal = interner.intern("Mortal");
let socrates = interner.intern("Socrates");
let args = [Term::Constant(socrates)];
let expr = LogicExpr::Predicate { name: mortal, args: &args, world: None };
assert_eq!(expr.with(&interner).to_string(), "Mortal(Socrates)");

Structs§

DebugWorld
WithInterner

Traits§

DisplayWith
Trait for formatting types that require an interner for symbol resolution.

Functions§

aspect_symbol
An aspect operator.
binary_temporal_symbol
A binary temporal operator: until, release, weak until.
connective_symbol
A connective’s symbol, from the one mapping every printer shares (Connective::of).
focus_symbol
A focus particle.
modal_symbol
A modal’s operator. The boundary must match the formatter (formatter.rs) and the Kripke lowering (semantics/kripke.rs): force == 0.5 (ability/epistemic can/could/may) is the weak/possibility side (◇), not necessity.
quantifier_symbol
A quantifier’s symbol, with its count for the numeric ones (∃=2, ∃≥3).
temporal_symbol
A tense operator: P past, F future or eventually, G always, X next.
voice_symbol
A voice operator.