Skip to main content

Parser

Struct Parser 

Source
pub struct Parser<'a, 'ctx, 'int> { /* private fields */ }
Expand description

Recursive descent parser for natural language to first-order logic.

The parser transforms a token stream (from Lexer) into logical expressions (LogicExpr). It handles complex linguistic phenomena including:

  • Quantifier scope ambiguity
  • Pronoun resolution via DRS
  • Modal verb interpretation
  • Temporal and aspectual marking
  • VP ellipsis resolution

§Lifetimes

  • 'a: Arena lifetime for allocated AST nodes
  • 'ctx: WorldState lifetime for discourse tracking
  • 'int: Interner lifetime for symbol management

Implementations§

Source§

impl<'a, 'ctx, 'int> Parser<'a, 'ctx, 'int>

Source

pub fn new( tokens: Vec<Token>, world_state: &'ctx mut WorldState, interner: &'int mut Interner, ctx: AstContext<'a>, types: TypeRegistry, ) -> Parser<'a, 'ctx, 'int>

Create a parser with WorldState for discourse-level parsing. WorldState is REQUIRED - there is no “single sentence mode”. A single sentence is just a discourse of length 1.

Source

pub fn stmt_spans(&self) -> &[Span]

The span of each top-level statement from the last parse_program call, aligned 1:1 with the returned statement list.

Source

pub fn set_discourse_event_var(&mut self, var: Symbol)

Source

pub fn drs_mut(&mut self) -> &mut Drs

Get mutable reference to the active DRS (from WorldState).

Source

pub fn drs_ref(&self) -> &Drs

Get immutable reference to the active DRS (from WorldState).

Source

pub fn swap_drs_with_world_state(&mut self)

Swap DRS between Parser and WorldState. Call at start of parsing to get the accumulated DRS from WorldState. Call at end of parsing to save the updated DRS back to WorldState.

Source

pub fn has_world_state(&self) -> bool

WorldState is always present (no “single sentence mode”)

Source

pub fn mode(&self) -> ParserMode

Source

pub fn is_known_type(&self, sym: Symbol) -> bool

Check if a symbol is a known type in the registry. Used to disambiguate “Stack of Integers” (generic type) vs “Owner of House” (possessive).

Source

pub fn is_generic_type(&self, sym: Symbol) -> bool

Check if a symbol is a known generic type (takes type parameters). Used to parse “Stack of Integers” as generic instantiation.

Source

pub fn process_block_headers(&mut self)

Source

pub fn get_event_var(&mut self) -> Symbol

Source

pub fn capture_event_template( &mut self, verb: Symbol, roles: &[(ThematicRole, Term<'a>)], modifiers: &[Symbol], )

Source

pub fn set_pp_attachment_mode(&mut self, attach_to_noun: bool)

Source

pub fn set_noun_priority_mode(&mut self, mode: bool)

Source

pub fn set_collective_mode(&mut self, mode: bool)

Source

pub fn set_distributive_marker(&mut self, on: bool)

Force the distributive (per-member) reading of mixed verbs with definite plurals — the readings enumerator’s counterpart to the default collective reading.

Source

pub fn set_pragmatic_mode(&mut self, on: bool)

Enable pragmatic enrichment (scalar implicatures, degree standards) for whole-program parses — the defeasible theorem door needs the implicature channel that the literal parse omits.

Source

pub fn set_event_reading_mode(&mut self, mode: bool)

Source

pub fn set_negative_scope_mode(&mut self, mode: NegativeScopeMode)

Source

pub fn set_modal_preference(&mut self, pref: ModalPreference)

Source

pub fn guard(&mut self) -> ParserGuard<'_, 'a, 'ctx, 'int>

Source

pub fn parse(&mut self) -> Result<&'a LogicExpr<'a>, ParseError>

Parses the token stream into a logical expression.

This is the main entry point for declarative/FOL parsing. It handles multi-sentence inputs by conjoining them with logical AND, and processes various sentence types including declaratives, questions, and imperatives.

§Returns

An arena-allocated LogicExpr representing the parsed input, or a ParseError with source location and Socratic explanation.

§Discourse State

The parser maintains discourse state across sentences, enabling anaphora resolution (“he”, “she”, “they” refer to prior entities) and temporal coherence (tense interpretation relative to reference time).

Source

pub fn parse_pragmatic(&mut self) -> Result<&'a LogicExpr<'a>, ParseError>

Parses with pragmatic enrichment: the truth-conditional parse PLUS scalar implicature (§8.7). The literal parse() is unchanged; here a leading weak scalar “some” is strengthened to ∃… +> ¬∀…. Used by the pragmatic compile path so the implicature appears as a separate labeled component.

Source

pub fn parse_program(&mut self) -> Result<Vec<Stmt<'a>>, ParseError>

Parses a LOGOS program into a list of statements.

This is the main entry point for imperative/executable LOGOS code. It handles block structures (Definition, Policy, Procedure, Theorem), function definitions, type definitions, and executable statements.

§Returns

A vector of arena-allocated Stmt representing the program, or a ParseError with source location and Socratic explanation.

§Block Types
  • Definition: Type definitions (structs, enums, generics)
  • Policy: Security predicates and capability rules
  • Procedure: Executable code blocks
  • Theorem: Logical propositions with proof strategies
Source

pub fn program_opt_flags(&self) -> OptimizationConfig

The program-wide optimization config from file-level ## No <X> decorators (all-on minus the file-level disables). The compile entry combines this with from_env and per-function flags.

Source

pub fn program_tier_pins(&self) -> PinSet

The program-wide tiered-optimizer pins from file-level ## Tier <opt> <value> decorators (HOTSWAP §8). The run-path engine overlays these onto the env crate::optimization::HotswapConfig before optimizing.

Trait Implementations§

Source§

impl<'a, 'ctx, 'int> ClauseParsing<'a, 'ctx, 'int> for Parser<'a, 'ctx, 'int>

Source§

fn is_reduced_relative_verb(&self, vp: usize) -> bool

True when the verb at vp heads a reduced object relative — i.e. it is the finite verb of a relativizer-dropped clause modifying a preceding noun head, not a main-clause verb. The relative’s overt subject (a ProperName or Pronoun) sits at vp - 1, and the relativized head is the determiner-headed common noun that immediately precedes that subject (“the friend [Simon] went”, “the waterfall [Derrick] photographed”). The determiner requirement is what distinguishes this from a true main clause whose initial word is a subject (“Set A has …” — “A” has no determiner-headed noun before it).

Source§

fn try_parse_fronted_temporal_adjunct( &mut self, ) -> Result<Option<&'a LogicExpr<'a>>, ParseError>

A sentence-initial temporal NP that FRAMES the clause rather than serving as its subject: “Every year Simon takes a holiday” → HAB over the whole clause. Fires only for “Every/All ” FOLLOWED BY a clause subject; a time NP that is itself the subject (“Every year is long”) has a copula/verb next and is left to the ordinary quantifier path.

Source§

fn parse_either_or(&mut self) -> Result<&'a LogicExpr<'a>, ParseError>

Parse “Either NP1 or NP2 is/are PRED” or “Either S1 or S2”

Handles coordination: “Either Alice or Bob is guilty” should become guilty(Alice) ∨ guilty(Bob), not Alice ∨ guilty(Bob)

Source§

fn parse_gapped_clause( &mut self, borrowed_verb: Symbol, ) -> Result<&'a LogicExpr<'a>, ParseError>

Phase 46: Generalized gapping with template-guided reconstruction. Handles NPs, PPs, temporal adverbs, and preserves roles from EventTemplate.

Source§

fn parse_disjunction(&mut self) -> Result<&'a LogicExpr<'a>, ParseError>

Parse disjunction (Or/Iff) - lowest precedence logical connectives. Calls parse_conjunction for operands to ensure And binds tighter.

Source§

fn extract_copular_subject(&self, expr: &'a LogicExpr<'a>) -> Option<Symbol>

Parse conjunction (And) - higher precedence than Or. Calls parse_atom for operands. Extracts the subject of a copular predication (the first Constant argument of a copular Predicate), digging through degree/aspect/boolean wrappers. Returns None for event predications (NeoEvent) and variable subjects, so only true copular clauses (“X is ADJ/NP”) trigger predicate coordination.

Source§

fn try_parse_copular_predicate( &mut self, subject: Symbol, ) -> Result<Option<&'a LogicExpr<'a>>, ParseError>

Parses a bare copular-predicate remnant — an adjective (“wealthy”) or a predicate nominal (“a philanthropist”) — as Predicate(subject). Returns None (consuming nothing) if the next tokens are not such a remnant.

Source§

fn try_parse_imperative( &mut self, ) -> Result<Option<&'a LogicExpr<'a>>, ParseError>

Attempts to parse an English imperative (“Close the door.”, “Don’t touch that.”, “Let’s leave.”). Returns None (restoring position) when the input is not verb-initial / not a hortative or negative command.
Source§

fn clause_has_later_finite_verb(&self, from: usize) -> bool

True if a finite verb (Verb/Auxiliary/copula/have/modal) appears at or after from, before the clause terminator. Used to distinguish an imperative (command verb is the only finite verb) from a declarative whose initial word is a subject (“Set A has cardinality 5.”).
Source§

fn try_parse_cleft(&mut self) -> Result<Option<&'a LogicExpr<'a>>, ParseError>

Attempts to parse an it-cleft “It was X who/that VP.” → focus on X plus exhaustivity (only X did it). Returns None (restoring position) otherwise.
Source§

fn try_parse_exclamative( &mut self, ) -> Result<Option<&'a LogicExpr<'a>>, ParseError>

Attempts to parse an exclamative “How tall she is!” / “What a fool he is!” (how/what, no subject-aux inversion, “!”-terminated). Returns None otherwise.
Source§

fn try_parse_optative( &mut self, ) -> Result<Option<&'a LogicExpr<'a>>, ParseError>

Attempts to parse an optative wish “May you prosper!”, “Long live the king!”, “If only it were Friday!”. Returns None (restoring position) otherwise.
Source§

fn try_parse_correlative( &mut self, ) -> Result<Option<&'a LogicExpr<'a>>, ParseError>

Attempts to parse correlative coordination “Neither X nor Y VP” / “Either X or Y VP” — a shared predicate scoped over two subjects. None otherwise.
Source§

fn try_parse_inverted_conditional( &mut self, ) -> Result<Option<&'a LogicExpr<'a>>, ParseError>

Attempts to parse an inverted conditional “Had/Were/Should SUBJECT …, …” by un-inverting to the canonical “If SUBJECT aux …” form and reusing the conditional parser. Handles multi-word subjects and Should-fronting. None otherwise.
Source§

fn parse_sentence(&mut self) -> Result<&'a LogicExpr<'a>, ParseError>

Parses a complete sentence, handling imperatives, ellipsis, and questions.
Source§

fn check_wh_word(&self) -> bool

Checks if current token is a wh-word (who, what, which, etc.).
Source§

fn parse_conditional(&mut self) -> Result<&'a LogicExpr<'a>, ParseError>

Parses “if P then Q” conditionals with DRS scope handling.
Source§

fn is_counterfactual_context(&self) -> bool

Returns true if parsing a counterfactual context.
Source§

fn parse_counterfactual_antecedent( &mut self, ) -> Result<&'a LogicExpr<'a>, ParseError>

Parses “if P were/had” counterfactual antecedent (subjunctive).
Source§

fn parse_counterfactual_consequent( &mut self, ) -> Result<&'a LogicExpr<'a>, ParseError>

Parses “Q would” counterfactual consequent.
Source§

fn extract_verb_from_expr(&self, expr: &LogicExpr<'a>) -> Option<Symbol>

Extracts the main verb from an expression.
Source§

fn is_complete_clause(&self, expr: &LogicExpr<'a>) -> bool

Returns true if expression is a complete clause.
Source§

fn parse_conjunction(&mut self) -> Result<&'a LogicExpr<'a>, ParseError>

Parses “P and Q” conjunctions with scope coordination.
Source§

fn parse_relative_clause( &mut self, gap_var: Symbol, ) -> Result<&'a LogicExpr<'a>, ParseError>

Parses “who/that/which” relative clauses attaching to noun phrases.
Source§

fn check_ellipsis_auxiliary(&self) -> bool

Checks for ellipsis auxiliary (did, does, can, etc.).
Source§

fn check_ellipsis_terminator(&self) -> bool

Checks for ellipsis terminator (too, also, as well).
Source§

fn try_parse_ellipsis( &mut self, ) -> Option<Result<&'a LogicExpr<'a>, ParseError>>

Attempts to parse VP ellipsis (“Mary did too”).
Source§

fn try_parse_of_pair_xor( &mut self, ) -> Result<Option<&'a LogicExpr<'a>>, ParseError>

Attempts to parse “Of NP₁ and NP₂, one VP₁ and the other VP₂” → (VP₁(NP₁) ∧ VP₂(NP₂)) ∨ (VP₁(NP₂) ∧ VP₂(NP₁)). Returns None otherwise.
Source§

impl<'a, 'ctx, 'int> LogicVerbParsing<'a, 'ctx, 'int> for Parser<'a, 'ctx, 'int>

Source§

fn build_group_predicate( &mut self, subjects: &[Symbol], verb: Symbol, verb_time: Time, ) -> &'a LogicExpr<'a>

Build a group predicate for intransitive verbs

Source§

fn build_group_transitive( &mut self, subjects: &[Symbol], objects: &[Symbol], verb: Symbol, verb_time: Time, ) -> &'a LogicExpr<'a>

Build a transitive predicate with group subject and group object

Source§

fn parse_predicate_with_subject( &mut self, subject_symbol: Symbol, ) -> Result<&'a LogicExpr<'a>, ParseError>

Parses a verb phrase given the subject as a constant symbol.
Source§

fn parse_predicate_with_subject_as_var( &mut self, subject_symbol: Symbol, ) -> Result<&'a LogicExpr<'a>, ParseError>

Parses a verb phrase with subject as a bound variable.
Source§

fn try_parse_plural_subject( &mut self, first_subject: &NounPhrase<'a>, ) -> Result<Option<&'a LogicExpr<'a>>, ParseError>

Attempts to parse a plural subject (“John and Mary verb”). Returns Ok(Some(expr)) on success, Ok(None) if not plural, Err on semantic error.
Source§

fn parse_control_structure( &mut self, subject: &NounPhrase<'a>, verb: Symbol, verb_time: Time, ) -> Result<&'a LogicExpr<'a>, ParseError>

Parses control verb structures: “wants to VP”, “persuaded X to VP”.
Source§

fn is_control_verb(&self, verb: Symbol) -> bool

Checks if a verb is a control verb (want, try, persuade, etc.).
Source§

impl<'a, 'ctx, 'int> ModalParsing<'a, 'ctx, 'int> for Parser<'a, 'ctx, 'int>

Source§

fn parse_modal(&mut self) -> Result<&'a LogicExpr<'a>, ParseError>

Parses a modal verb and its scope content.
Source§

fn parse_aspect_chain( &mut self, subject_symbol: Symbol, ) -> Result<&'a LogicExpr<'a>, ParseError>

Parses perfect/progressive aspect chain with a symbol subject.
Source§

fn parse_aspect_chain_with_term( &mut self, subject_term: Term<'a>, ) -> Result<&'a LogicExpr<'a>, ParseError>

Parses perfect/progressive aspect chain with a term subject.
Source§

fn token_to_vector(&self, token: &TokenType) -> ModalVector

Converts a modal token to its semantic vector (domain, force, flavor).
Source§

impl<'a, 'ctx, 'int> NounParsing<'a, 'ctx, 'int> for Parser<'a, 'ctx, 'int>

Source§

fn peek_reduced_object_relative(&self) -> bool

Whether the cursor is at the SUBJECT of an active object-gap reduced relative (“the prize | Tara won”, cursor at “Tara”). The PROPER, deterministic test (no trial-parse): a proper-name / pronoun subject, then a TRANSITIVE verb (only a transitive verb has an object slot for the head to fill — an intransitive “the dancer Tara performed” is apposition, not a relative), then an EMPTY object slot — the token after the verb does NOT start a direct object (an overt object “the dancer Tara won THE PRIZE” is apposition, not a gap). The caller additionally requires a determiner-headed NP.

Source§

fn parse_noun_phrase( &mut self, greedy: bool, ) -> Result<NounPhrase<'a>, ParseError>

Parses a full noun phrase with optional greedy PP attachment.
Source§

fn parse_noun_phrase_for_relative( &mut self, ) -> Result<NounPhrase<'a>, ParseError>

Parses a noun phrase suitable for relative clause antecedent.
Source§

fn noun_phrase_to_term(&self, np: &NounPhrase<'a>) -> Term<'a>

Converts a parsed noun phrase to a first-order term.
Source§

fn numeric_label_head( &mut self, n: i64, head: Symbol, definiteness: Option<Definiteness>, measure_restrictors: &mut Vec<&'a LogicExpr<'a>>, ) -> Symbol

Resolves a numeric LABEL (“the 2003 holiday”, “the 1850 stamp”): returns the head symbol, FUSED (2003_holiday) by default, but UN-FUSED to the bare head plus a category relation restrictor (pushed onto measure_restrictors) when n names a DRS-declared item whose category maps to a preposition.
Source§

fn consume_label_head_noun_first(&mut self) -> Result<Symbol, ParseError>

Consume a numeric-label HEAD preferring the NOUN reading of a verb-ambiguous word, so the fused symbol matches the noun-compound form (“the 2001 trip” → 2001_trip, not the verb lemma 2001_Trip). A verb-only head (“stamp”) has no noun reading and keeps its lemma; a plain noun (“holiday”) is already the noun. (The un-fused predicate is capitalized downstream regardless.)
Source§

fn check_possessive(&self) -> bool

Checks for possessive marker (’s).
Source§

fn peek_definite_reduced_relative_object(&self) -> bool

Whether the cursor sits on a DEFINITE article that opens a noun phrase whose head is modified by a reduced object relative (“the friend Simon went with”, “the waterfall Derrick photographed”). Used by the object-NP dispatcher to route such an object through the full parse_noun_phrase machinery instead of pre-consuming the article (which would hide the relative).
Source§

fn check_of_preposition(&self) -> bool

Checks for “of” preposition (possessive or partitive).
Source§

fn check_proper_name_or_label(&self) -> bool

Checks for proper name or label (capitalized).
Source§

fn check_possessive_pronoun(&self) -> bool

Checks for possessive pronoun (his, her, its, their).
Source§

impl<'a, 'ctx, 'int> PragmaticsParsing<'a, 'ctx, 'int> for Parser<'a, 'ctx, 'int>

Source§

fn parse_equative( &mut self, subject: &NounPhrase<'a>, ) -> Result<&'a LogicExpr<'a>, ParseError>

Parses the equative frame “X is as ADJ as Y” → an at-least () degree comparison. The parser is positioned at the first “as”; the subject’s definiteness wrapping is applied by the caller.

Source§

fn parse_focus(&mut self) -> Result<&'a LogicExpr<'a>, ParseError>

Parses a focus particle construction: “only John runs”, “even Mary left”. Read more
Source§

fn parse_measure(&mut self) -> Result<&'a LogicExpr<'a>, ParseError>

Parses a measure construction: “much water is cold”, “little food arrived”. Read more
Source§

fn parse_presupposition( &mut self, subject: &NounPhrase<'a>, presup_kind: PresupKind, negated: bool, ) -> Result<&'a LogicExpr<'a>, ParseError>

Parses a presupposition-triggering verb: “stopped running”, “regrets leaving”. Read more
Source§

fn parse_presupposition_for_term( &mut self, subject_term: Term<'a>, presup_kind: PresupKind, negated: bool, ) -> Result<&'a LogicExpr<'a>, ParseError>

Term-parametric form of Self::parse_presupposition — the subject is a TERM (constant or a relativized variable) so the same presupposition grammar composes over a relative-clause subject (“the person who won started skydiving 2 years after …”).
Source§

fn parse_predicate_for_subject( &mut self, subject: &NounPhrase<'a>, ) -> Result<&'a LogicExpr<'a>, ParseError>

Parses a simple predicate for a given subject noun phrase. Read more
Source§

fn parse_scopal_adverb( &mut self, subject: &NounPhrase<'a>, ) -> Result<&'a LogicExpr<'a>, ParseError>

Parses a scopal adverb construction: “always runs”, “never sleeps”. Read more
Source§

fn parse_superlative( &mut self, subject: &NounPhrase<'a>, ) -> Result<&'a LogicExpr<'a>, ParseError>

Parses a superlative construction: “is the tallest student”. Read more
Source§

fn parse_comparative( &mut self, subject: &NounPhrase<'a>, _copula_time: Time, difference: Option<&'a Term<'a>>, ) -> Result<&'a LogicExpr<'a>, ParseError>

Parses a comparative construction: “is taller than Mary”, “is greater than 0”. Read more
Source§

fn check_number(&self) -> bool

Checks if the current token is a numeric literal. Read more
Source§

fn parse_measure_phrase(&mut self) -> Result<&'a Term<'a>, ParseError>

Parses a measure phrase: “5 meters”, “100 kilograms”. Read more
Source§

fn counting_np_lookahead(&self) -> Option<u32>

Recognises a digit-led COUNTING noun phrase in object position — Number (adjective)+ Noun (“6 brown manatees”, “49 previous jumps”) — and returns its integer count. Read more
Source§

impl<'a, 'ctx, 'int> QuantifierParsing<'a, 'ctx, 'int> for Parser<'a, 'ctx, 'int>

Source§

fn adjective_restriction( &mut self, adj: Symbol, var: Symbol, noun: Symbol, ) -> &'a LogicExpr<'a>

Build the restriction conjunct contributed by a pre-nominal adjective, dispatching on the adjective’s lexical class. This is the single shared site every NP-restriction path routes through, so the four classes are modeled identically everywhere (universal, indefinite, definite, copular):

  • Relational / pertainymic (lexicon relational): predicate of a kind by default — Rel(x, ^Base) (no ∃) — or, at level: Instance, an existential over a base-noun individual — ∃y(Base(y) ∧ Rel(x, y)). (McNally & Boleda 2004.)
  • Subsective: Adj(x, ^Noun) — graded against the head-noun kind.
  • Intersective / other (incl. NonIntersective, whose privative meaning is supplied later by the axiom layer): flat Adj(x).
Source§

fn parse_copula_pp_complement( &mut self, subj_var: Symbol, ) -> Result<&'a LogicExpr<'a>, ParseError>

Parse a copula PP complement under a quantifier — “is in Florida or in Maine” → In(subj,Florida) ∨ In(subj,Maine), subj_var being the bound variable. Captures the or-coordination (“or in B” repeats the preposition, “or B” reuses it) that the backtracking fallback path otherwise drops.
Source§

fn parse_quantified(&mut self) -> Result<&'a LogicExpr<'a>, ParseError>

Parses a quantified expression from a quantifier determiner.
Source§

fn parse_quantified_core(&mut self) -> Result<&'a LogicExpr<'a>, ParseError>

The quantifier-parsing body; parse_quantified wraps its result with any pending partitive-superset presupposition (§5.3).
Source§

fn parse_restriction( &mut self, var_name: Symbol, ) -> Result<&'a LogicExpr<'a>, ParseError>

Parses the restrictor clause for a quantifier.
Source§

fn parse_verb_phrase_for_restriction( &mut self, var_name: Symbol, ) -> Result<&'a LogicExpr<'a>, ParseError>

Parses a verb phrase as the nuclear scope of a quantifier.
Source§

fn combine_with_and( &self, exprs: Vec<&'a LogicExpr<'a>>, ) -> Result<&'a LogicExpr<'a>, ParseError>

Combines multiple expressions with conjunction.
Source§

fn wrap_with_definiteness_full( &mut self, np: &NounPhrase<'a>, predicate: &'a LogicExpr<'a>, ) -> Result<&'a LogicExpr<'a>, ParseError>

Source§

fn wrap_with_definiteness( &mut self, definiteness: Option<Definiteness>, noun: Symbol, predicate: &'a LogicExpr<'a>, ) -> Result<&'a LogicExpr<'a>, ParseError>

Source§

fn wrap_with_definiteness_and_adjectives( &mut self, definiteness: Option<Definiteness>, noun: Symbol, adjectives: &[Symbol], predicate: &'a LogicExpr<'a>, ) -> Result<&'a LogicExpr<'a>, ParseError>

Source§

fn wrap_with_definiteness_and_adjectives_and_pps( &mut self, definiteness: Option<Definiteness>, noun: Symbol, adjectives: &[Symbol], pps: &[&'a LogicExpr<'a>], predicate: &'a LogicExpr<'a>, ) -> Result<&'a LogicExpr<'a>, ParseError>

Source§

fn wrap_with_definiteness_for_object( &mut self, definiteness: Option<Definiteness>, noun: Symbol, predicate: &'a LogicExpr<'a>, ) -> Result<&'a LogicExpr<'a>, ParseError>

Source§

fn substitute_pp_placeholder( &mut self, pp: &'a LogicExpr<'a>, var: Symbol, ) -> &'a LogicExpr<'a>

Source§

fn substitute_constant_with_var( &self, expr: &'a LogicExpr<'a>, constant_name: Symbol, var_name: Symbol, ) -> Result<&'a LogicExpr<'a>, ParseError>

Source§

fn substitute_constant_with_var_sym( &self, expr: &'a LogicExpr<'a>, constant_name: Symbol, var_name: Symbol, ) -> Result<&'a LogicExpr<'a>, ParseError>

Source§

fn substitute_variable_with_constant( &self, expr: &'a LogicExpr<'a>, from_var: Symbol, to_const: Symbol, ) -> Result<&'a LogicExpr<'a>, ParseError>

Rewrite a relativized gap variable into a constant, so a subject’s relative-clause restriction (built over from_var) can be folded into a predicate keyed on to_const and then re-bound uniformly by wrap_with_definiteness.
Source§

fn substitute_constant_with_sigma( &self, expr: &'a LogicExpr<'a>, constant_name: Symbol, sigma_term: Term<'a>, ) -> Result<&'a LogicExpr<'a>, ParseError>

Source§

fn find_main_verb_name(&self, expr: &LogicExpr<'a>) -> Option<Symbol>

Source§

fn transform_cardinal_to_group( &mut self, expr: &'a LogicExpr<'a>, ) -> Result<&'a LogicExpr<'a>, ParseError>

Source§

fn build_verb_neo_event( &mut self, verb: Symbol, subject_var: Symbol, object: Option<Term<'a>>, modifiers: Vec<Symbol>, ) -> &'a LogicExpr<'a>

Source§

impl<'a, 'ctx, 'int> QuestionParsing<'a, 'ctx, 'int> for Parser<'a, 'ctx, 'int>

Source§

fn parse_wh_question(&mut self) -> Result<&'a LogicExpr<'a>, ParseError>

Parses a wh-question: “Who runs?”, “What does John love?”.
Source§

fn parse_yes_no_question(&mut self) -> Result<&'a LogicExpr<'a>, ParseError>

Parses a yes/no question: “Does John run?”, “Is Mary tall?”.
Source§

fn aux_token_to_modal_vector(&self, token: &TokenType) -> ModalVector

Converts an auxiliary token to its modal vector for questions.

Auto Trait Implementations§

§

impl<'a, 'ctx, 'int> Freeze for Parser<'a, 'ctx, 'int>

§

impl<'a, 'ctx, 'int> !RefUnwindSafe for Parser<'a, 'ctx, 'int>

§

impl<'a, 'ctx, 'int> !Send for Parser<'a, 'ctx, 'int>

§

impl<'a, 'ctx, 'int> !Sync for Parser<'a, 'ctx, 'int>

§

impl<'a, 'ctx, 'int> Unpin for Parser<'a, 'ctx, 'int>

§

impl<'a, 'ctx, 'int> UnsafeUnpin for Parser<'a, 'ctx, 'int>

§

impl<'a, 'ctx, 'int> !UnwindSafe for Parser<'a, 'ctx, 'int>

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
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
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> Same for T

Source§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,