33 releases (breaking)

✓ Uses Rust 2018 edition

new 0.23.0 May 22, 2020
0.21.0 May 7, 2020
0.17.0 Mar 31, 2020
0.14.0 Dec 9, 2019
0.6.0 Nov 2, 2018

#109 in Parser implementations

Download history 1/week @ 2020-01-24 36/week @ 2020-02-14 72/week @ 2020-02-21 144/week @ 2020-02-28 48/week @ 2020-03-06 24/week @ 2020-03-13 74/week @ 2020-03-20 106/week @ 2020-03-27 17/week @ 2020-04-03 234/week @ 2020-04-10 48/week @ 2020-04-17 7/week @ 2020-04-24 10/week @ 2020-05-01 53/week @ 2020-05-08

304 downloads per month

MIT license

100KB
3K SLoC

tptp

A crate for reading files in the TPTP format.

Features

  • nom parsers for maximum flexibility
  • high-performance, streaming, zero-copy parsing
  • convenient abstractions: visitor pattern, input iterator
  • complete CNF/FOF dialect support
  • adherence to TPTP BNF: transform as you wish
  • comprehensive test suite

Documentation

See docs.rs. The examples/ directory contains some trivial programs. tptp2json/ contains a slightly-less trivial program to transform TPTP input to JSON Lines via the magic of serde.

Performance

Unscientific benchmark:

$ cargo bench
100000 iterations, 2159 bytes of SYN000-1.p
1.03 seconds total (189.87 MB/s).
100000 iterations, 2702 bytes of SYN000+1.p
1.89 seconds total (123.13 MB/s).
$

examples/validate currently checks 458MB of CSR002+5.ax in under 4 seconds.

Limitations

Since this is effectively recursive-descent parsing, extremely-deeply-nested structures will cause you to run out of stack: this has not been a problem in practice. Parsers work only on byte slices: this is by design. If you want to read data from somewhere, either use mmap(2) (useful for large files) or read data in chunks until you can parse an input. See nom's streaming documentation.

Wishlist

  • FOFX/TFF/THF support?

Dependencies

~4MB
~69K SLoC