code wiki / (root) / nx_fof_parse.nx

nx_fof_parse.nx

buildroot/runtime/nx_fof_parse.nx

13745 B340 linesdepth 6pulls 10 transitivereach 5 importersview sourcekind librarytopic fof
docsdependenciesstructsconstsfunctions

about

nx_fof_parse.nx -- TPTP FOF formula parser. Per Vampire-displacement roadmap Phase 2. Recursive-descent parser over the FOF connective grammar. Produces an *Fof tree; CNF conversion (Skolemize + distribute) is a separate primitive that consumes the tree. Grammar (TPTP FOF subset, with precedence shown): formula ::= iff (lowest prec) iff ::= imp { "<=>" imp } imp ::= or { "=>" or } (right-assoc) or_expr ::= and_expr { "|" and_expr } and_expr ::= unitary { "&" unitary } unitary ::= "~" unitary | quantified | "(" formula ")" | atom quantified ::= ("!" | "?") "[" var { "," var } "]" ":" unitary atom ::= predicate-application | term "=" term | term "!=" term | term (handled at term level) Multi-var quantifier ![X, Y]: body is sugar for ![X]: ![Y]: body. Returns null on parse failure. Caller can re-parse with debug instrumentation if needed; the next refinement is Result-typed errors with parse-position context.

dependencies 9 imports · 5 importers

nx_syscalls.nx nx_runtime.nx nx_tier.nx nx_str.nx nx_result.nx nx_unify.nx nx_tptp_symtab.nx nx_tptp_term.nx nx_fof.nx nx_fof_parse.nx nx_casc_runner_test.nx nx_fof_cnf_test.nx nx_fof_parse_test.nx nx_fof_tseitin_test.nx nx_tptp_load_any.nx

imports: nx_syscalls.nxnx_runtime.nxnx_tier.nxnx_str.nxnx_result.nxnx_unify.nxnx_tptp_symtab.nxnx_tptp_term.nxnx_fof.nx

imported by: nx_casc_runner_test.nxnx_fof_cnf_test.nxnx_fof_parse_test.nxnx_fof_tseitin_test.nxnx_tptp_load_any.nx

structs

none

consts

none

functions

56func nx_fof_parse_iff(buf: *u8, n: nx_int, pos: *nx_int,
58func nx_fof_parse_unitary(buf: *u8, n: nx_int, pos: *nx_int,
60func nx_fof_parse_quantified(buf: *u8, n: nx_int, pos: *nx_int,
66func nx_fof_peek_is(buf: *u8, n: nx_int, pos: *nx_int, c: nx_int) -> nx_int
called by 1: nx_fof_eat calls 1: nx_tptp_term_skip_ws
74func nx_fof_eat(buf: *u8, n: nx_int, pos: *nx_int, c: nx_int) -> nx_int
84func nx_fof_eat2(buf: *u8, n: nx_int, pos: *nx_int, c1: nx_int, c2: nx_int) -> nx_int
93func nx_fof_eat3(buf: *u8, n: nx_int, pos: *nx_int, c1: nx_int, c2: nx_int, c3: nx_int) -> nx_int
108func nx_fof_parse_atom(buf: *u8, n: nx_int, pos: *nx_int,
147func nx_fof_parse_unitary(buf: *u8, n: nx_int, pos: *nx_int,
226func nx_fof_parse_quantified(buf: *u8, n: nx_int, pos: *nx_int,
285func nx_fof_parse_and(buf: *u8, n: nx_int, pos: *nx_int,
298func nx_fof_parse_or(buf: *u8, n: nx_int, pos: *nx_int,
311func nx_fof_parse_imp(buf: *u8, n: nx_int, pos: *nx_int,
324func nx_fof_parse_iff(buf: *u8, n: nx_int, pos: *nx_int,
337func nx_fof_parse(buf: *u8, n: nx_int, pos: *nx_int,