1
/* Copyright (C) 2006, 2007 William McCune
3
This file is part of the LADR Deduction Library.
5
The LADR Deduction Library is free software; you can redistribute it
6
and/or modify it under the terms of the GNU General Public License,
9
The LADR Deduction Library is distributed in the hope that it will be
10
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
14
You should have received a copy of the GNU General Public License
15
along with the LADR Deduction Library; if not, write to the Free Software
16
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19
#ifndef TP_FASTPARSE_H
20
#define TP_FASTPARSE_H
25
This package is meant for use when there are a great number
26
of terms to be read and written. I wrote it when I was
27
looking for a single axiom for lattice theory and was
28
filtering trillions (really) of equations.
30
The ordinary parsing is very general and rather slow.
32
This package reads and writes prefix terms, without parentheses
33
commas, or spaces. Each symbol is one character.
34
Each term to be read starts on a new line and ends with a period.
35
The user has to declare the arities of symbols
36
by calling fast_set_symbol().
38
Here's an example to read lattice equations in fast-parse form and
39
write them in ordinary form.
41
int main(int argc, char **argv)
44
fast_set_symbol('=', 2);
45
fast_set_symbol('m', 2);
46
fast_set_symbol('j', 2);
47
t = fast_read_term(stdin, stderr);
49
fwrite_term_nl(stdout, t);
51
t = fast_read_term(stdin, stderr);
57
There are also routines for reading and writing fast-parse clauses.
60
/* Public definitions */
62
/* End of public definitions */
64
/* Public function prototypes from fastparse.c */
66
void fast_set_symbol(char c, int arity);
68
void fast_set_defaults(void);
70
Term fast_read_term(FILE *fin, FILE *fout);
72
void fast_fwrite_term_nl(FILE *fp, Term t);
74
Topform fast_read_clause(FILE *fin, FILE *fout);
76
void fast_fwrite_clause(FILE *fp, Topform c);
78
#endif /* conditional compilation of whole file */