%{ /* Compile with -DP_VERBOSE=1 for verbose output. */ /* Compile with -DP_USERPROC=1 to #include p_user_proc.c. */ /* p_user_proc.c should #define P_ACT, P_BUILD, P_TOKEN, P_PRINT to*/ /* different procedures from those below, and supply code. */ /* *_strict rules are documentation; unreachable; hand-code semantic actions.*/ #include #include #include #ifndef P_VERBOSE # define P_VERBOSE 0 #endif #ifdef P_USERPROC # include "p_user_proc.c" #else # define P_ACT(ss) if(verbose)printf("%7d %s\n",yylineno,ss); # define P_BUILD(sym,A,B,C,D,E,F,G,H,I,J) pBuildTree(sym,A,B,C,D,E,F,G,H,I,J) # define P_TOKEN(tok,symIdx) pToken(tok,symIdx) # define P_PRINT(ss) if(verbose){printf("\n\n");pPrintTree(ss,0);} #endif #define MAX_CH 12 extern int yylineno; extern int tptp_store_size; extern char* tptp_lval[]; int verbose = P_VERBOSE; char pTokenBuf[8240]; /* pPrintIdx is where to find top-level comments to print before a sentence. yywrap() gets those after last sentence. */ int pPrintIdx = 0; typedef struct pTreeNode * pTree; struct pTreeNode {char* sym; int symIdx; pTree ch[MAX_CH+1];}; pTree pBuildTree(char* sym, pTree A, pTree B, pTree C, pTree D, pTree E, pTree F, pTree G, pTree H, pTree I, pTree J); pTree pBuildTree(char* sym, pTree A, pTree B, pTree C, pTree D, pTree E, pTree F, pTree G, pTree H, pTree I, pTree J) { pTree ss = (pTree)calloc(1,sizeof(struct pTreeNode)); ss->sym = sym; ss->symIdx = -1; ss->ch[0] = A; ss->ch[1] = B; ss->ch[2] = C; ss->ch[3] = D; ss->ch[4] = E; ss->ch[5] = F; ss->ch[6] = G; ss->ch[7] = H; ss->ch[8] = I; ss->ch[9] = J; ss->ch[10] = 0; return ss; } pTree pToken(char* tok, int symIdx); pTree pToken(char* tok, int symIdx) { pTree ss; char* sym = tptp_lval[symIdx]; char* safeSym; strncpy(pTokenBuf, tok, 39); strncat(pTokenBuf, sym, 8193); safeSym = strdup(pTokenBuf); ss = pBuildTree(safeSym,0,0,0,0,0,0,0,0,0,0); ss->symIdx = symIdx; return ss; } void pPrintComments(int start, int depth); void pPrintComments(int start, int depth) { int d, j; char c1[4] = "%", c2[4] = "/*"; j = start; while (tptp_lval[j] != NULL && (tptp_lval[j][0]==c1[0] || (tptp_lval[j][0]==c2[0] && tptp_lval[j][1]==c2[1]))) { for (d=0; d= 0) { pPrintComments(pPrintIdx, 0); pPrintIdx = -1;} if (ss == NULL) return; for (d = 0; d < depth; d++) printf(" "); if (ss->ch[0] == 0) printf("%s\n", ss->sym); else printf("<%s>\n", ss->sym); if (strcmp(ss->sym, "PERIOD .") == 0) pPrintIdx = (ss->symIdx+1)%tptp_store_size; if (ss->symIdx >= 0) pPrintComments((ss->symIdx+1)%tptp_store_size, depth); i = 0; while(ss->ch[i] != 0) {pPrintTree(ss->ch[i], depth+1); i++;} return; } int yywrap(void) { P_PRINT(NULL); return 1; } %} %union {int ival; double dval; char* sval; void* pval;} %start TPTP_file %token AMPERSAND %token AT_SIGN %token CARET %token COLON %token COLON_EQUALS %token COMMA %token EQUALS %token EQUALS_GREATER %token EXCLAMATION %token EXCLAMATION_EQUALS %token GREATER %token LBRKT %token LESS_EQUALS %token LESS_EQUALS_GREATER %token LESS_TILDE_GREATER %token LPAREN %token MINUS_GREATER %token PERIOD %token QUESTION %token RBRKT %token RPAREN %token STAR %token TILDE %token TILDE_AMPERSAND %token TILDE_VLINE %token VLINE %token _DLR_false %token _DLR_i %token _DLR_iType %token _DLR_o %token _DLR_oType %token _DLR_t %token _DLR_tType %token _DLR_true %token _LIT_cnf %token _LIT_fof %token _LIT_include %token _LIT_lambda %token _LIT_letrec %token _LIT_tff %token _LIT_thf %token distinct_object %token dollar_dollar_word %token dollar_word %token lower_word %token plus %token real %token signed_integer %token single_quoted %token unrecognized %token unsigned_integer %token upper_word %% TPTP_file : null {} | TPTP_file TPTP_input {} ; TPTP_input : annotated_formula {P_PRINT($$);} | include {P_PRINT($$);} ; annotated_formula : fof_annotated {$$ = P_BUILD("annotated_formula", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | cnf_annotated {$$ = P_BUILD("annotated_formula", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | thf_annotated {$$ = P_BUILD("annotated_formula", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | tff_annotated {$$ = P_BUILD("annotated_formula", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} ; fof_annotated : _LIT_fof LPAREN name COMMA formula_role COMMA fof_formula annotations RPAREN PERIOD {$$ = P_BUILD("fof_annotated", P_TOKEN("_LIT_fof ", $1), P_TOKEN("LPAREN ", $2), $3, P_TOKEN("COMMA ", $4), $5, P_TOKEN("COMMA ", $6), $7, $8, P_TOKEN("RPAREN ", $9), P_TOKEN("PERIOD ", $10));} ; cnf_annotated : _LIT_cnf LPAREN name COMMA formula_role COMMA cnf_formula annotations RPAREN PERIOD {$$ = P_BUILD("cnf_annotated", P_TOKEN("_LIT_cnf ", $1), P_TOKEN("LPAREN ", $2), $3, P_TOKEN("COMMA ", $4), $5, P_TOKEN("COMMA ", $6), $7, $8, P_TOKEN("RPAREN ", $9), P_TOKEN("PERIOD ", $10));} ; thf_annotated : _LIT_thf LPAREN name COMMA formula_role COMMA thf_formula annotations RPAREN PERIOD {$$ = P_BUILD("thf_annotated", P_TOKEN("_LIT_thf ", $1), P_TOKEN("LPAREN ", $2), $3, P_TOKEN("COMMA ", $4), $5, P_TOKEN("COMMA ", $6), $7, $8, P_TOKEN("RPAREN ", $9), P_TOKEN("PERIOD ", $10));} ; tff_annotated : _LIT_tff LPAREN name COMMA formula_role COMMA tff_formula annotations RPAREN PERIOD {$$ = P_BUILD("tff_annotated", P_TOKEN("_LIT_tff ", $1), P_TOKEN("LPAREN ", $2), $3, P_TOKEN("COMMA ", $4), $5, P_TOKEN("COMMA ", $6), $7, $8, P_TOKEN("RPAREN ", $9), P_TOKEN("PERIOD ", $10));} ; annotations : null {$$ = P_BUILD("annotations", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | COMMA source optional_info {$$ = P_BUILD("annotations", P_TOKEN("COMMA ", $1), $2, $3, 0, 0, 0, 0, 0, 0, 0);} ; formula_role : lower_word {$$ = P_BUILD("formula_role", P_TOKEN("lower_word ", $1), 0, 0, 0, 0, 0, 0, 0, 0, 0);} ; fof_formula : binary_formula {$$ = P_BUILD("fof_formula", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | unitary_formula {$$ = P_BUILD("fof_formula", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} ; binary_formula : nonassoc_binary {$$ = P_BUILD("binary_formula", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | assoc_binary {$$ = P_BUILD("binary_formula", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} ; nonassoc_binary : unitary_formula binary_connective unitary_formula {$$ = P_BUILD("nonassoc_binary", $1, $2, $3, 0, 0, 0, 0, 0, 0, 0);} ; binary_connective : LESS_EQUALS_GREATER {$$ = P_BUILD("binary_connective", P_TOKEN("LESS_EQUALS_GREATER ", $1), 0, 0, 0, 0, 0, 0, 0, 0, 0);} | EQUALS_GREATER {$$ = P_BUILD("binary_connective", P_TOKEN("EQUALS_GREATER ", $1), 0, 0, 0, 0, 0, 0, 0, 0, 0);} | LESS_EQUALS {$$ = P_BUILD("binary_connective", P_TOKEN("LESS_EQUALS ", $1), 0, 0, 0, 0, 0, 0, 0, 0, 0);} | LESS_TILDE_GREATER {$$ = P_BUILD("binary_connective", P_TOKEN("LESS_TILDE_GREATER ", $1), 0, 0, 0, 0, 0, 0, 0, 0, 0);} | TILDE_VLINE {$$ = P_BUILD("binary_connective", P_TOKEN("TILDE_VLINE ", $1), 0, 0, 0, 0, 0, 0, 0, 0, 0);} | TILDE_AMPERSAND {$$ = P_BUILD("binary_connective", P_TOKEN("TILDE_AMPERSAND ", $1), 0, 0, 0, 0, 0, 0, 0, 0, 0);} ; assoc_binary : or_formula {$$ = P_BUILD("assoc_binary", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | and_formula {$$ = P_BUILD("assoc_binary", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} ; or_formula : unitary_formula VLINE unitary_formula {$$ = P_BUILD("or_formula", $1, P_TOKEN("VLINE ", $2), $3, 0, 0, 0, 0, 0, 0, 0);} | unitary_formula VLINE or_formula {$$ = P_BUILD("or_formula", $1, P_TOKEN("VLINE ", $2), $3, 0, 0, 0, 0, 0, 0, 0);} ; and_formula : unitary_formula AMPERSAND unitary_formula {$$ = P_BUILD("and_formula", $1, P_TOKEN("AMPERSAND ", $2), $3, 0, 0, 0, 0, 0, 0, 0);} | unitary_formula AMPERSAND and_formula {$$ = P_BUILD("and_formula", $1, P_TOKEN("AMPERSAND ", $2), $3, 0, 0, 0, 0, 0, 0, 0);} ; assoc_connective : VLINE {$$ = P_BUILD("assoc_connective", P_TOKEN("VLINE ", $1), 0, 0, 0, 0, 0, 0, 0, 0, 0);} | AMPERSAND {$$ = P_BUILD("assoc_connective", P_TOKEN("AMPERSAND ", $1), 0, 0, 0, 0, 0, 0, 0, 0, 0);} ; unitary_formula : quantified_formula {$$ = P_BUILD("unitary_formula", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | unary_formula {$$ = P_BUILD("unitary_formula", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | atomic_formula {$$ = P_BUILD("unitary_formula", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | LPAREN fof_formula RPAREN {$$ = P_BUILD("unitary_formula", P_TOKEN("LPAREN ", $1), $2, P_TOKEN("RPAREN ", $3), 0, 0, 0, 0, 0, 0, 0);} ; quantified_formula : quantifier LBRKT variable_list RBRKT COLON unitary_formula {$$ = P_BUILD("quantified_formula", $1, P_TOKEN("LBRKT ", $2), $3, P_TOKEN("RBRKT ", $4), P_TOKEN("COLON ", $5), $6, 0, 0, 0, 0);} ; quantifier : EXCLAMATION {$$ = P_BUILD("quantifier", P_TOKEN("EXCLAMATION ", $1), 0, 0, 0, 0, 0, 0, 0, 0, 0);} | QUESTION {$$ = P_BUILD("quantifier", P_TOKEN("QUESTION ", $1), 0, 0, 0, 0, 0, 0, 0, 0, 0);} ; variable_list : variable {$$ = P_BUILD("variable_list", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | variable COMMA variable_list {$$ = P_BUILD("variable_list", $1, P_TOKEN("COMMA ", $2), $3, 0, 0, 0, 0, 0, 0, 0);} ; unary_formula : unary_connective unitary_formula {$$ = P_BUILD("unary_formula", $1, $2, 0, 0, 0, 0, 0, 0, 0, 0);} ; unary_connective : TILDE {$$ = P_BUILD("unary_connective", P_TOKEN("TILDE ", $1), 0, 0, 0, 0, 0, 0, 0, 0, 0);} ; cnf_formula : LPAREN disjunction RPAREN {$$ = P_BUILD("cnf_formula", P_TOKEN("LPAREN ", $1), $2, P_TOKEN("RPAREN ", $3), 0, 0, 0, 0, 0, 0, 0);} | disjunction {$$ = P_BUILD("cnf_formula", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} ; disjunction : literal {$$ = P_BUILD("disjunction", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | literal VLINE disjunction {$$ = P_BUILD("disjunction", $1, P_TOKEN("VLINE ", $2), $3, 0, 0, 0, 0, 0, 0, 0);} ; literal : atomic_formula {$$ = P_BUILD("literal", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | TILDE atomic_formula {$$ = P_BUILD("literal", P_TOKEN("TILDE ", $1), $2, 0, 0, 0, 0, 0, 0, 0, 0);} ; thf_formula : thf_binary_formula {$$ = P_BUILD("thf_formula", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | thf_unitary_formula {$$ = P_BUILD("thf_formula", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | thf_definition {$$ = P_BUILD("thf_formula", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} ; thf_binary_formula : thf_nonassoc_formula {$$ = P_BUILD("thf_binary_formula", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | thf_assoc_formula {$$ = P_BUILD("thf_binary_formula", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | thf_apply_formula {$$ = P_BUILD("thf_binary_formula", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | thf_equality {$$ = P_BUILD("thf_binary_formula", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | thf_binary_type {$$ = P_BUILD("thf_binary_formula", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} ; thf_nonassoc_formula : thf_unitary_formula binary_connective thf_unitary_formula {$$ = P_BUILD("thf_nonassoc_formula", $1, $2, $3, 0, 0, 0, 0, 0, 0, 0);} ; thf_equality : thf_unitary_formula EQUALS thf_unitary_formula {$$ = P_BUILD("thf_equality", $1, P_TOKEN("EQUALS ", $2), $3, 0, 0, 0, 0, 0, 0, 0);} ; thf_assoc_formula : thf_or_formula {$$ = P_BUILD("thf_assoc_formula", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | thf_and_formula {$$ = P_BUILD("thf_assoc_formula", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} ; thf_or_formula : thf_unitary_formula VLINE thf_unitary_formula {$$ = P_BUILD("thf_or_formula", $1, P_TOKEN("VLINE ", $2), $3, 0, 0, 0, 0, 0, 0, 0);} | thf_or_formula VLINE thf_unitary_formula {$$ = P_BUILD("thf_or_formula", $1, P_TOKEN("VLINE ", $2), $3, 0, 0, 0, 0, 0, 0, 0);} ; thf_and_formula : thf_unitary_formula AMPERSAND thf_unitary_formula {$$ = P_BUILD("thf_and_formula", $1, P_TOKEN("AMPERSAND ", $2), $3, 0, 0, 0, 0, 0, 0, 0);} | thf_and_formula AMPERSAND thf_unitary_formula {$$ = P_BUILD("thf_and_formula", $1, P_TOKEN("AMPERSAND ", $2), $3, 0, 0, 0, 0, 0, 0, 0);} ; thf_unitary_formula : thf_atom {$$ = P_BUILD("thf_unitary_formula", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | thf_let_rec {$$ = P_BUILD("thf_unitary_formula", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | thf_abstraction {$$ = P_BUILD("thf_unitary_formula", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | thf_unary_formula {$$ = P_BUILD("thf_unitary_formula", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | thf_quantified_formula {$$ = P_BUILD("thf_unitary_formula", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | LPAREN thf_tuple RPAREN {$$ = P_BUILD("thf_unitary_formula", P_TOKEN("LPAREN ", $1), $2, P_TOKEN("RPAREN ", $3), 0, 0, 0, 0, 0, 0, 0);} | LPAREN thf_binary_formula RPAREN {$$ = P_BUILD("thf_unitary_formula", P_TOKEN("LPAREN ", $1), $2, P_TOKEN("RPAREN ", $3), 0, 0, 0, 0, 0, 0, 0);} | LPAREN thf_unitary_formula RPAREN {$$ = P_BUILD("thf_unitary_formula", P_TOKEN("LPAREN ", $1), $2, P_TOKEN("RPAREN ", $3), 0, 0, 0, 0, 0, 0, 0);} ; thf_quantified_formula : thf_quantifier LBRKT thf_variable_list RBRKT COLON thf_unitary_formula {$$ = P_BUILD("thf_quantified_formula", $1, P_TOKEN("LBRKT ", $2), $3, P_TOKEN("RBRKT ", $4), P_TOKEN("COLON ", $5), $6, 0, 0, 0, 0);} ; thf_quantifier : EXCLAMATION {$$ = P_BUILD("thf_quantifier", P_TOKEN("EXCLAMATION ", $1), 0, 0, 0, 0, 0, 0, 0, 0, 0);} | QUESTION {$$ = P_BUILD("thf_quantifier", P_TOKEN("QUESTION ", $1), 0, 0, 0, 0, 0, 0, 0, 0, 0);} ; thf_variable_list : thf_variable {$$ = P_BUILD("thf_variable_list", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | thf_variable COMMA thf_variable_list {$$ = P_BUILD("thf_variable_list", $1, P_TOKEN("COMMA ", $2), $3, 0, 0, 0, 0, 0, 0, 0);} ; thf_unary_formula : unary_connective thf_unitary_formula {$$ = P_BUILD("thf_unary_formula", $1, $2, 0, 0, 0, 0, 0, 0, 0, 0);} ; thf_abstraction : thf_lambda LBRKT thf_variable_list RBRKT COLON thf_unitary_formula {$$ = P_BUILD("thf_abstraction", $1, P_TOKEN("LBRKT ", $2), $3, P_TOKEN("RBRKT ", $4), P_TOKEN("COLON ", $5), $6, 0, 0, 0, 0);} ; thf_lambda : _LIT_lambda {$$ = P_BUILD("thf_lambda", P_TOKEN("_LIT_lambda ", $1), 0, 0, 0, 0, 0, 0, 0, 0, 0);} | CARET {$$ = P_BUILD("thf_lambda", P_TOKEN("CARET ", $1), 0, 0, 0, 0, 0, 0, 0, 0, 0);} ; thf_apply_formula : thf_apply_formula AT_SIGN thf_unitary_formula {$$ = P_BUILD("thf_apply_formula", $1, P_TOKEN("AT_SIGN ", $2), $3, 0, 0, 0, 0, 0, 0, 0);} | thf_unitary_formula AT_SIGN thf_unitary_formula {$$ = P_BUILD("thf_apply_formula", $1, P_TOKEN("AT_SIGN ", $2), $3, 0, 0, 0, 0, 0, 0, 0);} ; thf_tuple : thf_unitary_formula COMMA thf_tuple {$$ = P_BUILD("thf_tuple", $1, P_TOKEN("COMMA ", $2), $3, 0, 0, 0, 0, 0, 0, 0);} | thf_unitary_formula COMMA thf_unitary_formula {$$ = P_BUILD("thf_tuple", $1, P_TOKEN("COMMA ", $2), $3, 0, 0, 0, 0, 0, 0, 0);} ; thf_atom : thf_typed_atom {$$ = P_BUILD("thf_atom", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | thf_untyped_atom {$$ = P_BUILD("thf_atom", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} ; thf_typed_atom : thf_typed_constant {$$ = P_BUILD("thf_typed_atom", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | thf_typed_variable {$$ = P_BUILD("thf_typed_atom", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} ; thf_untyped_atom : thf_untyped_constant {$$ = P_BUILD("thf_untyped_atom", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | thf_untyped_variable {$$ = P_BUILD("thf_untyped_atom", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} ; thf_variable : thf_untyped_variable {$$ = P_BUILD("thf_variable", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | thf_typed_variable {$$ = P_BUILD("thf_variable", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} ; thf_typed_variable : thf_untyped_variable COLON thf_unitary_type {$$ = P_BUILD("thf_typed_variable", $1, P_TOKEN("COLON ", $2), $3, 0, 0, 0, 0, 0, 0, 0);} ; thf_untyped_variable : variable {$$ = P_BUILD("thf_untyped_variable", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} ; thf_typed_constant : thf_untyped_constant COLON thf_unitary_type {$$ = P_BUILD("thf_typed_constant", $1, P_TOKEN("COLON ", $2), $3, 0, 0, 0, 0, 0, 0, 0);} ; thf_untyped_constant : atomic_word {$$ = P_BUILD("thf_untyped_constant", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | number {$$ = P_BUILD("thf_untyped_constant", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | distinct_object {$$ = P_BUILD("thf_untyped_constant", P_TOKEN("distinct_object ", $1), 0, 0, 0, 0, 0, 0, 0, 0, 0);} | atomic_system_word {$$ = P_BUILD("thf_untyped_constant", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | thf_defined_word {$$ = P_BUILD("thf_untyped_constant", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | LPAREN tptp_operator RPAREN {$$ = P_BUILD("thf_untyped_constant", P_TOKEN("LPAREN ", $1), $2, P_TOKEN("RPAREN ", $3), 0, 0, 0, 0, 0, 0, 0);} ; thf_defined_word : defined_type {$$ = P_BUILD("thf_defined_word", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | defined_prop {$$ = P_BUILD("thf_defined_word", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} ; tptp_operator : unary_connective {$$ = P_BUILD("tptp_operator", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | binary_connective {$$ = P_BUILD("tptp_operator", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | assoc_connective {$$ = P_BUILD("tptp_operator", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | quantifier {$$ = P_BUILD("tptp_operator", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | EQUALS {$$ = P_BUILD("tptp_operator", P_TOKEN("EQUALS ", $1), 0, 0, 0, 0, 0, 0, 0, 0, 0);} ; thf_binary_type : thf_mapping_type {$$ = P_BUILD("thf_binary_type", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | thf_xprod_type {$$ = P_BUILD("thf_binary_type", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | thf_union_type {$$ = P_BUILD("thf_binary_type", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} ; thf_mapping_type : thf_unitary_type map_arrow thf_mapping_type {$$ = P_BUILD("thf_mapping_type", $1, $2, $3, 0, 0, 0, 0, 0, 0, 0);} | thf_unitary_type map_arrow thf_unitary_type {$$ = P_BUILD("thf_mapping_type", $1, $2, $3, 0, 0, 0, 0, 0, 0, 0);} ; thf_xprod_type : thf_xprod_type STAR thf_unitary_type {$$ = P_BUILD("thf_xprod_type", $1, P_TOKEN("STAR ", $2), $3, 0, 0, 0, 0, 0, 0, 0);} | thf_unitary_type STAR thf_unitary_type {$$ = P_BUILD("thf_xprod_type", $1, P_TOKEN("STAR ", $2), $3, 0, 0, 0, 0, 0, 0, 0);} ; thf_union_type : thf_union_type plus thf_unitary_type {$$ = P_BUILD("thf_union_type", $1, P_TOKEN("plus ", $2), $3, 0, 0, 0, 0, 0, 0, 0);} | thf_unitary_type plus thf_unitary_type {$$ = P_BUILD("thf_union_type", $1, P_TOKEN("plus ", $2), $3, 0, 0, 0, 0, 0, 0, 0);} ; thf_unitary_type : thf_unitary_formula {$$ = P_BUILD("thf_unitary_type", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} ; map_arrow : MINUS_GREATER {$$ = P_BUILD("map_arrow", P_TOKEN("MINUS_GREATER ", $1), 0, 0, 0, 0, 0, 0, 0, 0, 0);} | GREATER {$$ = P_BUILD("map_arrow", P_TOKEN("GREATER ", $1), 0, 0, 0, 0, 0, 0, 0, 0, 0);} ; thf_let_rec : _LIT_letrec LBRKT thf_definition_list RBRKT COLON thf_unitary_formula {$$ = P_BUILD("thf_let_rec", P_TOKEN("_LIT_letrec ", $1), P_TOKEN("LBRKT ", $2), $3, P_TOKEN("RBRKT ", $4), P_TOKEN("COLON ", $5), $6, 0, 0, 0, 0);} ; thf_definition_list : thf_definition {$$ = P_BUILD("thf_definition_list", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | thf_definition COMMA thf_definition_list {$$ = P_BUILD("thf_definition_list", $1, P_TOKEN("COMMA ", $2), $3, 0, 0, 0, 0, 0, 0, 0);} ; thf_definition : atomic_word COLON_EQUALS thf_unitary_formula {$$ = P_BUILD("thf_definition", $1, P_TOKEN("COLON_EQUALS ", $2), $3, 0, 0, 0, 0, 0, 0, 0);} | LPAREN thf_definition RPAREN {$$ = P_BUILD("thf_definition", P_TOKEN("LPAREN ", $1), $2, P_TOKEN("RPAREN ", $3), 0, 0, 0, 0, 0, 0, 0);} ; tff_formula : tff_binary_formula {$$ = P_BUILD("tff_formula", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | tff_unitary_formula {$$ = P_BUILD("tff_formula", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | tff_typed_atom {$$ = P_BUILD("tff_formula", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} ; tff_binary_formula : tff_nonassoc_binary {$$ = P_BUILD("tff_binary_formula", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | tff_assoc_binary {$$ = P_BUILD("tff_binary_formula", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} ; tff_nonassoc_binary : tff_unitary_formula binary_connective tff_unitary_formula {$$ = P_BUILD("tff_nonassoc_binary", $1, $2, $3, 0, 0, 0, 0, 0, 0, 0);} ; tff_assoc_binary : tff_or_formula {$$ = P_BUILD("tff_assoc_binary", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | tff_and_formula {$$ = P_BUILD("tff_assoc_binary", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} ; tff_or_formula : tff_unitary_formula VLINE tff_unitary_formula {$$ = P_BUILD("tff_or_formula", $1, P_TOKEN("VLINE ", $2), $3, 0, 0, 0, 0, 0, 0, 0);} | tff_unitary_formula VLINE tff_or_formula {$$ = P_BUILD("tff_or_formula", $1, P_TOKEN("VLINE ", $2), $3, 0, 0, 0, 0, 0, 0, 0);} ; tff_and_formula : tff_unitary_formula AMPERSAND tff_unitary_formula {$$ = P_BUILD("tff_and_formula", $1, P_TOKEN("AMPERSAND ", $2), $3, 0, 0, 0, 0, 0, 0, 0);} | tff_unitary_formula AMPERSAND tff_and_formula {$$ = P_BUILD("tff_and_formula", $1, P_TOKEN("AMPERSAND ", $2), $3, 0, 0, 0, 0, 0, 0, 0);} ; tff_unitary_formula : tff_quantified_formula {$$ = P_BUILD("tff_unitary_formula", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | tff_unary_formula {$$ = P_BUILD("tff_unitary_formula", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | atomic_formula {$$ = P_BUILD("tff_unitary_formula", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | LPAREN tff_binary_formula RPAREN {$$ = P_BUILD("tff_unitary_formula", P_TOKEN("LPAREN ", $1), $2, P_TOKEN("RPAREN ", $3), 0, 0, 0, 0, 0, 0, 0);} | LPAREN tff_unitary_formula RPAREN {$$ = P_BUILD("tff_unitary_formula", P_TOKEN("LPAREN ", $1), $2, P_TOKEN("RPAREN ", $3), 0, 0, 0, 0, 0, 0, 0);} ; tff_quantified_formula : quantifier LBRKT tff_variable_list RBRKT COLON tff_unitary_formula {$$ = P_BUILD("tff_quantified_formula", $1, P_TOKEN("LBRKT ", $2), $3, P_TOKEN("RBRKT ", $4), P_TOKEN("COLON ", $5), $6, 0, 0, 0, 0);} ; tff_variable_list : tff_variable {$$ = P_BUILD("tff_variable_list", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | tff_variable COMMA tff_variable_list {$$ = P_BUILD("tff_variable_list", $1, P_TOKEN("COMMA ", $2), $3, 0, 0, 0, 0, 0, 0, 0);} ; tff_unary_formula : unary_connective tff_unitary_formula {$$ = P_BUILD("tff_unary_formula", $1, $2, 0, 0, 0, 0, 0, 0, 0, 0);} ; tff_typed_atom : tff_untyped_atom COLON tff_type_spec {$$ = P_BUILD("tff_typed_atom", $1, P_TOKEN("COLON ", $2), $3, 0, 0, 0, 0, 0, 0, 0);} | LPAREN tff_typed_atom RPAREN {$$ = P_BUILD("tff_typed_atom", P_TOKEN("LPAREN ", $1), $2, P_TOKEN("RPAREN ", $3), 0, 0, 0, 0, 0, 0, 0);} ; tff_untyped_atom : functor {$$ = P_BUILD("tff_untyped_atom", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | defined_term {$$ = P_BUILD("tff_untyped_atom", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | system_functor {$$ = P_BUILD("tff_untyped_atom", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} ; tff_variable : tff_untyped_variable {$$ = P_BUILD("tff_variable", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | tff_typed_variable {$$ = P_BUILD("tff_variable", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} ; tff_typed_variable : tff_untyped_variable COLON tff_type_spec {$$ = P_BUILD("tff_typed_variable", $1, P_TOKEN("COLON ", $2), $3, 0, 0, 0, 0, 0, 0, 0);} ; tff_untyped_variable : variable {$$ = P_BUILD("tff_untyped_variable", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} ; tff_type_spec : tff_untyped_atom {$$ = P_BUILD("tff_type_spec", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | defined_type {$$ = P_BUILD("tff_type_spec", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | tff_type_expr {$$ = P_BUILD("tff_type_spec", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | LPAREN tff_type_spec RPAREN {$$ = P_BUILD("tff_type_spec", P_TOKEN("LPAREN ", $1), $2, P_TOKEN("RPAREN ", $3), 0, 0, 0, 0, 0, 0, 0);} ; tff_type_expr : LPAREN tff_binary_type RPAREN {$$ = P_BUILD("tff_type_expr", P_TOKEN("LPAREN ", $1), $2, P_TOKEN("RPAREN ", $3), 0, 0, 0, 0, 0, 0, 0);} ; tff_binary_type : tff_mapping_type {$$ = P_BUILD("tff_binary_type", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | tff_xprod_type {$$ = P_BUILD("tff_binary_type", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | tff_union_type {$$ = P_BUILD("tff_binary_type", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} ; tff_mapping_type : tff_unitary_type map_arrow tff_mapping_type {$$ = P_BUILD("tff_mapping_type", $1, $2, $3, 0, 0, 0, 0, 0, 0, 0);} | tff_unitary_type map_arrow tff_unitary_type {$$ = P_BUILD("tff_mapping_type", $1, $2, $3, 0, 0, 0, 0, 0, 0, 0);} ; tff_xprod_type : tff_xprod_type STAR tff_unitary_type {$$ = P_BUILD("tff_xprod_type", $1, P_TOKEN("STAR ", $2), $3, 0, 0, 0, 0, 0, 0, 0);} | tff_unitary_type STAR tff_unitary_type {$$ = P_BUILD("tff_xprod_type", $1, P_TOKEN("STAR ", $2), $3, 0, 0, 0, 0, 0, 0, 0);} ; tff_union_type : tff_union_type plus tff_unitary_type {$$ = P_BUILD("tff_union_type", $1, P_TOKEN("plus ", $2), $3, 0, 0, 0, 0, 0, 0, 0);} | tff_unitary_type plus tff_unitary_type {$$ = P_BUILD("tff_union_type", $1, P_TOKEN("plus ", $2), $3, 0, 0, 0, 0, 0, 0, 0);} ; tff_unitary_type : tff_untyped_atom {$$ = P_BUILD("tff_unitary_type", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | defined_type {$$ = P_BUILD("tff_unitary_type", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | tff_type_expr {$$ = P_BUILD("tff_unitary_type", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} ; atomic_formula : plain_atom {$$ = P_BUILD("atomic_formula", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | defined_atom {$$ = P_BUILD("atomic_formula", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | system_atom {$$ = P_BUILD("atomic_formula", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} ; plain_atom : plain_term {$$ = P_BUILD("plain_atom", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} ; arguments : term {$$ = P_BUILD("arguments", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | term COMMA arguments {$$ = P_BUILD("arguments", $1, P_TOKEN("COMMA ", $2), $3, 0, 0, 0, 0, 0, 0, 0);} ; defined_atom : defined_prop {$$ = P_BUILD("defined_atom", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | defined_pred LPAREN arguments RPAREN {$$ = P_BUILD("defined_atom", $1, P_TOKEN("LPAREN ", $2), $3, P_TOKEN("RPAREN ", $4), 0, 0, 0, 0, 0, 0);} | term defined_infix_pred term {$$ = P_BUILD("defined_atom", $1, $2, $3, 0, 0, 0, 0, 0, 0, 0);} ; defined_infix_pred : EQUALS {$$ = P_BUILD("defined_infix_pred", P_TOKEN("EQUALS ", $1), 0, 0, 0, 0, 0, 0, 0, 0, 0);} | EXCLAMATION_EQUALS {$$ = P_BUILD("defined_infix_pred", P_TOKEN("EXCLAMATION_EQUALS ", $1), 0, 0, 0, 0, 0, 0, 0, 0, 0);} ; defined_prop : _DLR_true {$$ = P_BUILD("defined_prop", P_TOKEN("_DLR_true ", $1), 0, 0, 0, 0, 0, 0, 0, 0, 0);} | _DLR_false {$$ = P_BUILD("defined_prop", P_TOKEN("_DLR_false ", $1), 0, 0, 0, 0, 0, 0, 0, 0, 0);} ; defined_pred : atomic_defined_word {$$ = P_BUILD("defined_pred", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} ; defined_type : _DLR_oType {$$ = P_BUILD("defined_type", P_TOKEN("_DLR_oType ", $1), 0, 0, 0, 0, 0, 0, 0, 0, 0);} | _DLR_o {$$ = P_BUILD("defined_type", P_TOKEN("_DLR_o ", $1), 0, 0, 0, 0, 0, 0, 0, 0, 0);} | _DLR_iType {$$ = P_BUILD("defined_type", P_TOKEN("_DLR_iType ", $1), 0, 0, 0, 0, 0, 0, 0, 0, 0);} | _DLR_i {$$ = P_BUILD("defined_type", P_TOKEN("_DLR_i ", $1), 0, 0, 0, 0, 0, 0, 0, 0, 0);} | _DLR_tType {$$ = P_BUILD("defined_type", P_TOKEN("_DLR_tType ", $1), 0, 0, 0, 0, 0, 0, 0, 0, 0);} | _DLR_t {$$ = P_BUILD("defined_type", P_TOKEN("_DLR_t ", $1), 0, 0, 0, 0, 0, 0, 0, 0, 0);} ; system_atom : system_term {$$ = P_BUILD("system_atom", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} ; term : function_term {$$ = P_BUILD("term", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | variable {$$ = P_BUILD("term", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} ; function_term : plain_term {$$ = P_BUILD("function_term", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | defined_term {$$ = P_BUILD("function_term", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | system_term {$$ = P_BUILD("function_term", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} ; plain_term : constant {$$ = P_BUILD("plain_term", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | functor LPAREN arguments RPAREN {$$ = P_BUILD("plain_term", $1, P_TOKEN("LPAREN ", $2), $3, P_TOKEN("RPAREN ", $4), 0, 0, 0, 0, 0, 0);} ; constant : atomic_word {$$ = P_BUILD("constant", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} ; functor : atomic_word {$$ = P_BUILD("functor", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} ; defined_term : number {$$ = P_BUILD("defined_term", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | distinct_object {$$ = P_BUILD("defined_term", P_TOKEN("distinct_object ", $1), 0, 0, 0, 0, 0, 0, 0, 0, 0);} ; system_term : system_constant {$$ = P_BUILD("system_term", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | system_functor LPAREN arguments RPAREN {$$ = P_BUILD("system_term", $1, P_TOKEN("LPAREN ", $2), $3, P_TOKEN("RPAREN ", $4), 0, 0, 0, 0, 0, 0);} ; system_functor : atomic_system_word {$$ = P_BUILD("system_functor", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} ; system_constant : atomic_system_word {$$ = P_BUILD("system_constant", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} ; variable : upper_word {$$ = P_BUILD("variable", P_TOKEN("upper_word ", $1), 0, 0, 0, 0, 0, 0, 0, 0, 0);} ; source : general_term {$$ = P_BUILD("source", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} ; optional_info : COMMA useful_info {$$ = P_BUILD("optional_info", P_TOKEN("COMMA ", $1), $2, 0, 0, 0, 0, 0, 0, 0, 0);} | null {$$ = P_BUILD("optional_info", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} ; useful_info : general_term_list {$$ = P_BUILD("useful_info", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} ; include : _LIT_include LPAREN file_name formula_selection RPAREN PERIOD {$$ = P_BUILD("include", P_TOKEN("_LIT_include ", $1), P_TOKEN("LPAREN ", $2), $3, $4, P_TOKEN("RPAREN ", $5), P_TOKEN("PERIOD ", $6), 0, 0, 0, 0);} ; formula_selection : COMMA LBRKT name_list RBRKT {$$ = P_BUILD("formula_selection", P_TOKEN("COMMA ", $1), P_TOKEN("LBRKT ", $2), $3, P_TOKEN("RBRKT ", $4), 0, 0, 0, 0, 0, 0);} | null {$$ = P_BUILD("formula_selection", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} ; name_list : name {$$ = P_BUILD("name_list", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | name COMMA name_list {$$ = P_BUILD("name_list", $1, P_TOKEN("COMMA ", $2), $3, 0, 0, 0, 0, 0, 0, 0);} ; general_term : general_data {$$ = P_BUILD("general_term", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | general_data COLON general_term {$$ = P_BUILD("general_term", $1, P_TOKEN("COLON ", $2), $3, 0, 0, 0, 0, 0, 0, 0);} | general_list {$$ = P_BUILD("general_term", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} ; general_data : atomic_word {$$ = P_BUILD("general_data", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | atomic_word LPAREN general_arguments RPAREN {$$ = P_BUILD("general_data", $1, P_TOKEN("LPAREN ", $2), $3, P_TOKEN("RPAREN ", $4), 0, 0, 0, 0, 0, 0);} | number {$$ = P_BUILD("general_data", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | distinct_object {$$ = P_BUILD("general_data", P_TOKEN("distinct_object ", $1), 0, 0, 0, 0, 0, 0, 0, 0, 0);} ; general_arguments : general_term {$$ = P_BUILD("general_arguments", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | general_term COMMA general_arguments {$$ = P_BUILD("general_arguments", $1, P_TOKEN("COMMA ", $2), $3, 0, 0, 0, 0, 0, 0, 0);} ; general_list : LBRKT RBRKT {$$ = P_BUILD("general_list", P_TOKEN("LBRKT ", $1), P_TOKEN("RBRKT ", $2), 0, 0, 0, 0, 0, 0, 0, 0);} | LBRKT general_term_list RBRKT {$$ = P_BUILD("general_list", P_TOKEN("LBRKT ", $1), $2, P_TOKEN("RBRKT ", $3), 0, 0, 0, 0, 0, 0, 0);} ; general_term_list : general_term {$$ = P_BUILD("general_term_list", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | general_term COMMA general_term_list {$$ = P_BUILD("general_term_list", $1, P_TOKEN("COMMA ", $2), $3, 0, 0, 0, 0, 0, 0, 0);} ; name : atomic_word {$$ = P_BUILD("name", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} | unsigned_integer {$$ = P_BUILD("name", P_TOKEN("unsigned_integer ", $1), 0, 0, 0, 0, 0, 0, 0, 0, 0);} ; atomic_word : lower_word {$$ = P_BUILD("atomic_word", P_TOKEN("lower_word ", $1), 0, 0, 0, 0, 0, 0, 0, 0, 0);} | single_quoted {$$ = P_BUILD("atomic_word", P_TOKEN("single_quoted ", $1), 0, 0, 0, 0, 0, 0, 0, 0, 0);} ; atomic_defined_word : dollar_word {$$ = P_BUILD("atomic_defined_word", P_TOKEN("dollar_word ", $1), 0, 0, 0, 0, 0, 0, 0, 0, 0);} ; atomic_system_word : dollar_dollar_word {$$ = P_BUILD("atomic_system_word", P_TOKEN("dollar_dollar_word ", $1), 0, 0, 0, 0, 0, 0, 0, 0, 0);} ; number : real {$$ = P_BUILD("number", P_TOKEN("real ", $1), 0, 0, 0, 0, 0, 0, 0, 0, 0);} | signed_integer {$$ = P_BUILD("number", P_TOKEN("signed_integer ", $1), 0, 0, 0, 0, 0, 0, 0, 0, 0);} | unsigned_integer {$$ = P_BUILD("number", P_TOKEN("unsigned_integer ", $1), 0, 0, 0, 0, 0, 0, 0, 0, 0);} ; file_name : atomic_word {$$ = P_BUILD("file_name", $1, 0, 0, 0, 0, 0, 0, 0, 0, 0);} ; null : {$$ = P_BUILD("null", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);} ;