nx_fof_parse.nx
buildroot/runtime/nx_fof_parse.nx
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
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
| 56 | func nx_fof_parse_iff(buf: *u8, n: nx_int, pos: *nx_int, |
| 58 | func nx_fof_parse_unitary(buf: *u8, n: nx_int, pos: *nx_int, |
| 60 | func nx_fof_parse_quantified(buf: *u8, n: nx_int, pos: *nx_int, called by 1: nx_fof_parse_unitary |
| 66 | func nx_fof_peek_is(buf: *u8, n: nx_int, pos: *nx_int, c: nx_int) -> nx_int |
| 74 | func nx_fof_eat(buf: *u8, n: nx_int, pos: *nx_int, c: nx_int) -> nx_int |
| 84 | func nx_fof_eat2(buf: *u8, n: nx_int, pos: *nx_int, c1: nx_int, c2: nx_int) -> nx_int |
| 93 | func nx_fof_eat3(buf: *u8, n: nx_int, pos: *nx_int, c1: nx_int, c2: nx_int, c3: nx_int) -> nx_int |
| 108 | func nx_fof_parse_atom(buf: *u8, n: nx_int, pos: *nx_int, called by 1: nx_fof_parse_unitary calls 4: nx_tptp_term_skip_wsnx_tptp_parse_termsys_mmapnx_term_app |
| 147 | func nx_fof_parse_unitary(buf: *u8, n: nx_int, pos: *nx_int, |
| 226 | func nx_fof_parse_quantified(buf: *u8, n: nx_int, pos: *nx_int, |
| 285 | func nx_fof_parse_and(buf: *u8, n: nx_int, pos: *nx_int, |
| 298 | func nx_fof_parse_or(buf: *u8, n: nx_int, pos: *nx_int, |
| 311 | func nx_fof_parse_imp(buf: *u8, n: nx_int, pos: *nx_int, called by 2: nx_fof_parse_impnx_fof_parse_iff calls 4: nx_fof_parse_ornx_fof_eat2nx_fof_parse_impnx_fof_binary |
| 324 | func nx_fof_parse_iff(buf: *u8, n: nx_int, pos: *nx_int, |
| 337 | func nx_fof_parse(buf: *u8, n: nx_int, pos: *nx_int, |