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>
impl<'a, 'ctx, 'int> Parser<'a, 'ctx, 'int>
Sourcepub fn new(
tokens: Vec<Token>,
world_state: &'ctx mut WorldState,
interner: &'int mut Interner,
ctx: AstContext<'a>,
types: TypeRegistry,
) -> Parser<'a, 'ctx, 'int>
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.
Sourcepub fn stmt_spans(&self) -> &[Span]
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.
pub fn set_discourse_event_var(&mut self, var: Symbol)
Sourcepub fn drs_mut(&mut self) -> &mut Drs
pub fn drs_mut(&mut self) -> &mut Drs
Get mutable reference to the active DRS (from WorldState).
Sourcepub fn swap_drs_with_world_state(&mut self)
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.
Sourcepub fn has_world_state(&self) -> bool
pub fn has_world_state(&self) -> bool
WorldState is always present (no “single sentence mode”)
pub fn mode(&self) -> ParserMode
Sourcepub fn is_known_type(&self, sym: Symbol) -> bool
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).
Sourcepub fn is_generic_type(&self, sym: Symbol) -> bool
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.
pub fn process_block_headers(&mut self)
pub fn get_event_var(&mut self) -> Symbol
pub fn capture_event_template( &mut self, verb: Symbol, roles: &[(ThematicRole, Term<'a>)], modifiers: &[Symbol], )
pub fn set_pp_attachment_mode(&mut self, attach_to_noun: bool)
pub fn set_noun_priority_mode(&mut self, mode: bool)
pub fn set_collective_mode(&mut self, mode: bool)
Sourcepub fn set_distributive_marker(&mut self, on: bool)
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.
Sourcepub fn set_pragmatic_mode(&mut self, on: bool)
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.
pub fn set_event_reading_mode(&mut self, mode: bool)
pub fn set_negative_scope_mode(&mut self, mode: NegativeScopeMode)
pub fn set_modal_preference(&mut self, pref: ModalPreference)
pub fn guard(&mut self) -> ParserGuard<'_, 'a, 'ctx, 'int>
Sourcepub fn parse(&mut self) -> Result<&'a LogicExpr<'a>, ParseError>
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).
Sourcepub fn parse_pragmatic(&mut self) -> Result<&'a LogicExpr<'a>, ParseError>
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.
Sourcepub fn parse_program(&mut self) -> Result<Vec<Stmt<'a>>, ParseError>
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
Sourcepub fn program_opt_flags(&self) -> OptimizationConfig
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.
Sourcepub fn program_tier_pins(&self) -> PinSet
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>
impl<'a, 'ctx, 'int> ClauseParsing<'a, 'ctx, 'int> for Parser<'a, 'ctx, 'int>
Source§fn is_reduced_relative_verb(&self, vp: usize) -> bool
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>
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
Source§fn parse_either_or(&mut self) -> Result<&'a LogicExpr<'a>, ParseError>
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>
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>
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>
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>
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>
fn try_parse_imperative( &mut self, ) -> Result<Option<&'a LogicExpr<'a>>, ParseError>
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
fn clause_has_later_finite_verb(&self, from: usize) -> bool
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>
fn try_parse_cleft(&mut self) -> Result<Option<&'a LogicExpr<'a>>, ParseError>
None (restoring position) otherwise.Source§fn try_parse_exclamative(
&mut self,
) -> Result<Option<&'a LogicExpr<'a>>, ParseError>
fn try_parse_exclamative( &mut self, ) -> Result<Option<&'a LogicExpr<'a>>, ParseError>
None otherwise.Source§fn try_parse_optative(
&mut self,
) -> Result<Option<&'a LogicExpr<'a>>, ParseError>
fn try_parse_optative( &mut self, ) -> Result<Option<&'a LogicExpr<'a>>, ParseError>
None (restoring position) otherwise.Source§fn try_parse_correlative(
&mut self,
) -> Result<Option<&'a LogicExpr<'a>>, ParseError>
fn try_parse_correlative( &mut self, ) -> Result<Option<&'a LogicExpr<'a>>, ParseError>
None otherwise.Source§fn try_parse_inverted_conditional(
&mut self,
) -> Result<Option<&'a LogicExpr<'a>>, ParseError>
fn try_parse_inverted_conditional( &mut self, ) -> Result<Option<&'a LogicExpr<'a>>, ParseError>
Should-fronting. None otherwise.Source§fn parse_sentence(&mut self) -> Result<&'a LogicExpr<'a>, ParseError>
fn parse_sentence(&mut self) -> Result<&'a LogicExpr<'a>, ParseError>
Source§fn check_wh_word(&self) -> bool
fn check_wh_word(&self) -> bool
Source§fn parse_conditional(&mut self) -> Result<&'a LogicExpr<'a>, ParseError>
fn parse_conditional(&mut self) -> Result<&'a LogicExpr<'a>, ParseError>
Source§fn is_counterfactual_context(&self) -> bool
fn is_counterfactual_context(&self) -> bool
Source§fn parse_counterfactual_antecedent(
&mut self,
) -> Result<&'a LogicExpr<'a>, ParseError>
fn parse_counterfactual_antecedent( &mut self, ) -> Result<&'a LogicExpr<'a>, ParseError>
Source§fn parse_counterfactual_consequent(
&mut self,
) -> Result<&'a LogicExpr<'a>, ParseError>
fn parse_counterfactual_consequent( &mut self, ) -> Result<&'a LogicExpr<'a>, ParseError>
Source§fn extract_verb_from_expr(&self, expr: &LogicExpr<'a>) -> Option<Symbol>
fn extract_verb_from_expr(&self, expr: &LogicExpr<'a>) -> Option<Symbol>
Source§fn is_complete_clause(&self, expr: &LogicExpr<'a>) -> bool
fn is_complete_clause(&self, expr: &LogicExpr<'a>) -> bool
Source§fn parse_conjunction(&mut self) -> Result<&'a LogicExpr<'a>, ParseError>
fn parse_conjunction(&mut self) -> Result<&'a LogicExpr<'a>, ParseError>
Source§fn parse_relative_clause(
&mut self,
gap_var: Symbol,
) -> Result<&'a LogicExpr<'a>, ParseError>
fn parse_relative_clause( &mut self, gap_var: Symbol, ) -> Result<&'a LogicExpr<'a>, ParseError>
Source§fn check_ellipsis_auxiliary(&self) -> bool
fn check_ellipsis_auxiliary(&self) -> bool
Source§fn check_ellipsis_terminator(&self) -> bool
fn check_ellipsis_terminator(&self) -> bool
Source§fn try_parse_ellipsis(
&mut self,
) -> Option<Result<&'a LogicExpr<'a>, ParseError>>
fn try_parse_ellipsis( &mut self, ) -> Option<Result<&'a LogicExpr<'a>, ParseError>>
Source§fn try_parse_of_pair_xor(
&mut self,
) -> Result<Option<&'a LogicExpr<'a>>, ParseError>
fn try_parse_of_pair_xor( &mut self, ) -> Result<Option<&'a LogicExpr<'a>>, ParseError>
None otherwise.Source§impl<'a, 'ctx, 'int> LogicVerbParsing<'a, 'ctx, 'int> for Parser<'a, 'ctx, 'int>
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>
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>
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>
fn parse_predicate_with_subject( &mut self, subject_symbol: Symbol, ) -> Result<&'a LogicExpr<'a>, ParseError>
Source§fn parse_predicate_with_subject_as_var(
&mut self,
subject_symbol: Symbol,
) -> Result<&'a LogicExpr<'a>, ParseError>
fn parse_predicate_with_subject_as_var( &mut self, subject_symbol: Symbol, ) -> Result<&'a LogicExpr<'a>, ParseError>
Source§fn try_parse_plural_subject(
&mut self,
first_subject: &NounPhrase<'a>,
) -> Result<Option<&'a LogicExpr<'a>>, ParseError>
fn try_parse_plural_subject( &mut self, first_subject: &NounPhrase<'a>, ) -> Result<Option<&'a LogicExpr<'a>>, ParseError>
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>
fn parse_control_structure( &mut self, subject: &NounPhrase<'a>, verb: Symbol, verb_time: Time, ) -> Result<&'a LogicExpr<'a>, ParseError>
Source§fn is_control_verb(&self, verb: Symbol) -> bool
fn is_control_verb(&self, verb: Symbol) -> bool
Source§impl<'a, 'ctx, 'int> ModalParsing<'a, 'ctx, 'int> for Parser<'a, 'ctx, 'int>
impl<'a, 'ctx, 'int> ModalParsing<'a, 'ctx, 'int> for Parser<'a, 'ctx, 'int>
Source§fn parse_modal(&mut self) -> Result<&'a LogicExpr<'a>, ParseError>
fn parse_modal(&mut self) -> Result<&'a LogicExpr<'a>, ParseError>
Source§fn parse_aspect_chain(
&mut self,
subject_symbol: Symbol,
) -> Result<&'a LogicExpr<'a>, ParseError>
fn parse_aspect_chain( &mut self, subject_symbol: Symbol, ) -> Result<&'a LogicExpr<'a>, ParseError>
Source§fn parse_aspect_chain_with_term(
&mut self,
subject_term: Term<'a>,
) -> Result<&'a LogicExpr<'a>, ParseError>
fn parse_aspect_chain_with_term( &mut self, subject_term: Term<'a>, ) -> Result<&'a LogicExpr<'a>, ParseError>
Source§fn token_to_vector(&self, token: &TokenType) -> ModalVector
fn token_to_vector(&self, token: &TokenType) -> ModalVector
Source§impl<'a, 'ctx, 'int> NounParsing<'a, 'ctx, 'int> for Parser<'a, 'ctx, 'int>
impl<'a, 'ctx, 'int> NounParsing<'a, 'ctx, 'int> for Parser<'a, 'ctx, 'int>
Source§fn peek_reduced_object_relative(&self) -> bool
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>
fn parse_noun_phrase( &mut self, greedy: bool, ) -> Result<NounPhrase<'a>, ParseError>
Source§fn parse_noun_phrase_for_relative(
&mut self,
) -> Result<NounPhrase<'a>, ParseError>
fn parse_noun_phrase_for_relative( &mut self, ) -> Result<NounPhrase<'a>, ParseError>
Source§fn noun_phrase_to_term(&self, np: &NounPhrase<'a>) -> Term<'a>
fn noun_phrase_to_term(&self, np: &NounPhrase<'a>) -> Term<'a>
Source§fn numeric_label_head(
&mut self,
n: i64,
head: Symbol,
definiteness: Option<Definiteness>,
measure_restrictors: &mut Vec<&'a LogicExpr<'a>>,
) -> Symbol
fn numeric_label_head( &mut self, n: i64, head: Symbol, definiteness: Option<Definiteness>, measure_restrictors: &mut Vec<&'a LogicExpr<'a>>, ) -> Symbol
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>
fn consume_label_head_noun_first(&mut self) -> Result<Symbol, ParseError>
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
fn check_possessive(&self) -> bool
Source§fn peek_definite_reduced_relative_object(&self) -> bool
fn peek_definite_reduced_relative_object(&self) -> bool
parse_noun_phrase machinery instead
of pre-consuming the article (which would hide the relative).Source§fn check_of_preposition(&self) -> bool
fn check_of_preposition(&self) -> bool
Source§fn check_proper_name_or_label(&self) -> bool
fn check_proper_name_or_label(&self) -> bool
Source§fn check_possessive_pronoun(&self) -> bool
fn check_possessive_pronoun(&self) -> bool
Source§impl<'a, 'ctx, 'int> PragmaticsParsing<'a, 'ctx, 'int> for Parser<'a, 'ctx, 'int>
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>
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>
fn parse_focus(&mut self) -> Result<&'a LogicExpr<'a>, ParseError>
Source§fn parse_measure(&mut self) -> Result<&'a LogicExpr<'a>, ParseError>
fn parse_measure(&mut self) -> Result<&'a LogicExpr<'a>, ParseError>
Source§fn parse_presupposition(
&mut self,
subject: &NounPhrase<'a>,
presup_kind: PresupKind,
negated: bool,
) -> Result<&'a LogicExpr<'a>, ParseError>
fn parse_presupposition( &mut self, subject: &NounPhrase<'a>, presup_kind: PresupKind, negated: bool, ) -> Result<&'a LogicExpr<'a>, ParseError>
Source§fn parse_presupposition_for_term(
&mut self,
subject_term: Term<'a>,
presup_kind: PresupKind,
negated: bool,
) -> Result<&'a LogicExpr<'a>, ParseError>
fn parse_presupposition_for_term( &mut self, subject_term: Term<'a>, presup_kind: PresupKind, negated: bool, ) -> Result<&'a LogicExpr<'a>, ParseError>
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>
fn parse_predicate_for_subject( &mut self, subject: &NounPhrase<'a>, ) -> Result<&'a LogicExpr<'a>, ParseError>
Source§fn parse_scopal_adverb(
&mut self,
subject: &NounPhrase<'a>,
) -> Result<&'a LogicExpr<'a>, ParseError>
fn parse_scopal_adverb( &mut self, subject: &NounPhrase<'a>, ) -> Result<&'a LogicExpr<'a>, ParseError>
Source§fn parse_superlative(
&mut self,
subject: &NounPhrase<'a>,
) -> Result<&'a LogicExpr<'a>, ParseError>
fn parse_superlative( &mut self, subject: &NounPhrase<'a>, ) -> Result<&'a LogicExpr<'a>, ParseError>
Source§fn parse_comparative(
&mut self,
subject: &NounPhrase<'a>,
_copula_time: Time,
difference: Option<&'a Term<'a>>,
) -> Result<&'a LogicExpr<'a>, ParseError>
fn parse_comparative( &mut self, subject: &NounPhrase<'a>, _copula_time: Time, difference: Option<&'a Term<'a>>, ) -> Result<&'a LogicExpr<'a>, ParseError>
Source§fn check_number(&self) -> bool
fn check_number(&self) -> bool
Source§fn parse_measure_phrase(&mut self) -> Result<&'a Term<'a>, ParseError>
fn parse_measure_phrase(&mut self) -> Result<&'a Term<'a>, ParseError>
Source§impl<'a, 'ctx, 'int> QuantifierParsing<'a, 'ctx, 'int> for Parser<'a, 'ctx, 'int>
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>
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, atlevel: 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>
fn parse_copula_pp_complement( &mut self, subj_var: Symbol, ) -> Result<&'a LogicExpr<'a>, ParseError>
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>
fn parse_quantified(&mut self) -> Result<&'a LogicExpr<'a>, ParseError>
Source§fn parse_quantified_core(&mut self) -> Result<&'a LogicExpr<'a>, ParseError>
fn parse_quantified_core(&mut self) -> Result<&'a LogicExpr<'a>, ParseError>
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>
fn parse_restriction( &mut self, var_name: Symbol, ) -> Result<&'a LogicExpr<'a>, ParseError>
Source§fn parse_verb_phrase_for_restriction(
&mut self,
var_name: Symbol,
) -> Result<&'a LogicExpr<'a>, ParseError>
fn parse_verb_phrase_for_restriction( &mut self, var_name: Symbol, ) -> Result<&'a LogicExpr<'a>, ParseError>
Source§fn combine_with_and(
&self,
exprs: Vec<&'a LogicExpr<'a>>,
) -> Result<&'a LogicExpr<'a>, ParseError>
fn combine_with_and( &self, exprs: Vec<&'a LogicExpr<'a>>, ) -> Result<&'a LogicExpr<'a>, ParseError>
fn wrap_with_definiteness_full( &mut self, np: &NounPhrase<'a>, predicate: &'a LogicExpr<'a>, ) -> Result<&'a LogicExpr<'a>, ParseError>
fn wrap_with_definiteness( &mut self, definiteness: Option<Definiteness>, noun: Symbol, predicate: &'a LogicExpr<'a>, ) -> Result<&'a LogicExpr<'a>, ParseError>
fn wrap_with_definiteness_and_adjectives( &mut self, definiteness: Option<Definiteness>, noun: Symbol, adjectives: &[Symbol], predicate: &'a LogicExpr<'a>, ) -> Result<&'a LogicExpr<'a>, ParseError>
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>
fn wrap_with_definiteness_for_object( &mut self, definiteness: Option<Definiteness>, noun: Symbol, predicate: &'a LogicExpr<'a>, ) -> Result<&'a LogicExpr<'a>, ParseError>
fn substitute_pp_placeholder( &mut self, pp: &'a LogicExpr<'a>, var: Symbol, ) -> &'a LogicExpr<'a>
fn substitute_constant_with_var( &self, expr: &'a LogicExpr<'a>, constant_name: Symbol, var_name: Symbol, ) -> Result<&'a LogicExpr<'a>, ParseError>
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>
fn substitute_variable_with_constant( &self, expr: &'a LogicExpr<'a>, from_var: Symbol, to_const: Symbol, ) -> Result<&'a LogicExpr<'a>, ParseError>
from_var) can be folded into a
predicate keyed on to_const and then re-bound uniformly by
wrap_with_definiteness.fn substitute_constant_with_sigma( &self, expr: &'a LogicExpr<'a>, constant_name: Symbol, sigma_term: Term<'a>, ) -> Result<&'a LogicExpr<'a>, ParseError>
fn find_main_verb_name(&self, expr: &LogicExpr<'a>) -> Option<Symbol>
fn transform_cardinal_to_group( &mut self, expr: &'a LogicExpr<'a>, ) -> Result<&'a LogicExpr<'a>, ParseError>
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>
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>
fn parse_wh_question(&mut self) -> Result<&'a LogicExpr<'a>, ParseError>
Source§fn parse_yes_no_question(&mut self) -> Result<&'a LogicExpr<'a>, ParseError>
fn parse_yes_no_question(&mut self) -> Result<&'a LogicExpr<'a>, ParseError>
Source§fn aux_token_to_modal_vector(&self, token: &TokenType) -> ModalVector
fn aux_token_to_modal_vector(&self, token: &TokenType) -> ModalVector
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.