Skip to main content

SemanticCompiler

Struct SemanticCompiler 

Source
pub struct SemanticCompiler {
    pub interner: Rodeo,
    pub var_counter: usize,
    pub errors: Vec<String>,
    /* private fields */
}
Expand description

Stateful compiler that transforms flat AST buffers into FOL logic forms.

Maintains a string interner, fresh variable counter, and context state for relative clauses, ka-abstractions, and ma query variables. Accumulated errors are checked after compilation.

Fields§

§interner: Rodeo

String interner for relation names and variable names.

§var_counter: usize

Monotonically increasing counter for generating fresh variable names.

§errors: Vec<String>

Accumulated semantic errors (e.g., ambiguous inject_variable). Checked after compilation; if non-empty, compile_buffer returns error.

Implementations§

Source§

impl SemanticCompiler

Source

pub fn compile_proposition( &mut self, proposition: &Proposition, predicates: &[Predicate], arguments: &[Argument], sentences: &[Sentence], ) -> IrForm

Compiles a proposition (predication) into FOL with quantifier scoping and tense wrapping.

Source

pub fn compile_sentence( &mut self, sentence_id: u32, predicates: &[Predicate], arguments: &[Argument], sentences: &[Sentence], ) -> IrForm

Compiles a sentence node (simple proposition or connected sentences) into FOL.

Source§

impl SemanticCompiler

Source

pub fn new() -> Self

Creates a new compiler with empty interner and zeroed counters.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.