InutitionTC  0.30
parserHelpers.h
Go to the documentation of this file.
1 /****************************************************************************
2  * Copyright (C) 2016 by University of Warsaw *
3  * *
4  * This file is part of IntuitionTC. *
5  * *
6  ****************************************************************************/
7 #ifndef _PARSERHELPERS_H
8 #define _PARSERHELPERS_H
9 
14 #include "envmap_base.h"
15 #include "vars_set.h"
16 #include "checker.h"
17 
25 typedef enum {
58 } eAnyH;
59 
61 typedef struct string {
66 } string;
67 
68 
69 #ifndef YYSTYPE_IS_DECLARED
70 
71 #define YYSTYPE_IS_DECLARED 1
72 
75 typedef union {
79  Any *any;
81  string name;
90 } YYSTYPE;
91 #endif /* !YYSTYPE_IS_DECLARED */
92 
93 #include "y.tab.h"
94 
95 
104 int yyparse(void);
105 
124 Any* createBasicBinary(eType kind, Any* arg1, Any* arg2);
125 
138 Name createWord(YYSTYPE* res);
139 
155 Any* composeAnyType(eType tp, Any* first, Any* second);
156 
175 Any* composeBinaryConnective(YYSTYPE res, Any* arg1, Any* arg2);
176 
194 
201 void freeQChain(Type* start);
202 
220 Any* composeQuantifier(eAnyH tp, nameSet* ns, Any* formula);
221 
222 
235 Any* composeTermVariable(string arg);
236 
249 Any* composeTypeVariable(string arg);
250 
266 Any* composeFunctorWithArguments(string name, envmap *arguments);
267 
284 Any* typeToTerm(Any* mtype);
285 
299 Term* typeToTermRaw(Type* mtype);
300 
301 
319 Any* createExFalso(Any* term, Any* formula);
320 
337 Any* createLambda(string vname, Any* vtype, Any* term);
338 
354 Any* createApp(Any* term1, Any* term2);
355 
376 Any* createAbstract(string name1, Any* type2, string name3,
377  Any* type4, Any* term5, Any* term6);
378 
397 Any* createExists(Any* type, Any* term1, Any* term2);
398 
418 Any* createCase(Any* term, McasIn* case1, McasIn* case2);
419 
438 Any* createIn(Any* term, Any* type, int which);
439 
456 Any* createProj(Any* term, int which);
457 
475 Any* createTuple(Any* type, Any* term1, Any* term2);
476 
477 
491 Any* createTermVar(string vname);
492 
511 McasIn* createCaseTerm(string name, Any* type, Any* term);
512 
520 Name getFreshName(envmap *env);
521 
522 #endif
Any * createExFalso(Any *term, Any *formula)
The procedure creates the ex falso quod libet proof term from given Term and Type.
Definition: parserHelpers.c:561
Finite sets with union operation.
eAnyH which
The type field; should always contain the value 0.
Definition: parserHelpers.h:63
Any * composeTypeVariable(string arg)
The procedure is used to create Type in Any wrapper with variable the name of which is given in the a...
Definition: parserHelpers.c:450
Any * createApp(Any *term1, Any *term2)
The procedure creates the application proof term from given two Term terms.
Definition: parserHelpers.c:598
The representation of the set that holds strings.
Definition: vars_set.h:26
The representation of the case subexpression.
Definition: checker.h:261
Any * createProj(Any *term, int which)
The procedure creates the projection (i.e. conjunction elimination) proof term from given product ter...
Definition: parserHelpers.c:714
McasIn * createCaseTerm(string name, Any *type, Any *term)
The procedure creates the case subexpression from given name of the variable, its type and the implem...
Definition: parserHelpers.c:775
eAnyH
The type of the values located in the first field of the union YYSTYPE passed as the return value in ...
Definition: parserHelpers.h:25
string name
A name of a parsed identifier to be used in terms.
Definition: parserHelpers.h:81
eAnyH kindof
Information on which particular type constructor has been read.
Definition: parserHelpers.h:77
envmap * emap
An envmap environment that contains a number of formulas or terms that involve sequences of terms (e...
Definition: parserHelpers.h:87
int yyparse(void)
The procedure parses the content of the file opened for parsing.
Definition: parserHelpers.h:47
Definition: parserHelpers.h:51
Operations on the data structure that represents environments.
Any * composeUnaryConnective(YYSTYPE res, Any *arg)
The procedure composes a new type from the argument and unary connective prescribed in the YYSTYPE un...
Definition: parserHelpers.c:239
Name createWord(YYSTYPE *res)
The procedure creates a string to be used as identifier.
Definition: parserHelpers.c:417
Definition: parserHelpers.h:49
Any * composeQuantifier(eAnyH tp, nameSet *ns, Any *formula)
The procedure is used to create a formula that starts with either universal or existential quantifier...
Definition: parserHelpers.c:345
Name getFreshName(envmap *env)
The procedure creates a name that does not occur in the given environment.
Definition: parserHelpers.c:793
nameSet * ns
A nameSet of terms or types used to construct terms that involve sequences of names (e...
Definition: parserHelpers.h:84
Definition: parserHelpers.h:39
Definitions of the base structures that represent the formulas and proofs.
Any * any
Container with a parsed subexpression.
Definition: parserHelpers.h:79
Any * createLambda(string vname, Any *vtype, Any *term)
The procedure creates the lambda proof term from given Name of the argument, its Type and body Term...
Definition: parserHelpers.c:579
Any * composeTermVariable(string arg)
The procedure is used to create Term in Any wrapper with variable the name of which is given in the a...
Definition: parserHelpers.c:431
void freeQChain(Type *start)
The procedure frees memory of a quantifier chain allocated in composeQuantifier.
Definition: parserHelpers.c:323
Definition: parserHelpers.h:31
Any * createTermVar(string vname)
The procedure creates the term variable proof term name of the variable.
Definition: parserHelpers.c:757
Definition: parserHelpers.h:33
Any * createIn(Any *term, Any *type, int which)
The procedure creates the injection (i.e. alternative introduction) proof term from given implementat...
Definition: parserHelpers.c:689
Definition: parserHelpers.h:37
Definition: parserHelpers.h:55
Any * composeFunctorWithArguments(string name, envmap *arguments)
The procedure creates a Type that is a predicate variable applied to the given sequence of arguments...
Definition: parserHelpers.c:477
A wrapper structure to pass along identifier names within the parser.
Definition: parserHelpers.h:61
The representation of the types in the typesystem.
Definition: checker.h:146
Definition: parserHelpers.h:27
McasIn * caseterm
A structure to hold a case of a case term.
Definition: parserHelpers.h:89
Definition: parserHelpers.h:29
The union type of the values passed as the return value in the parser.
Definition: parserHelpers.h:75
The representation of the dictionary to hold values wrapped in Any structure and available under stri...
Definition: envmap_base.h:27
struct string string
A wrapper structure to pass along identifier names within the parser.
Term * typeToTermRaw(Type *mtype)
The procedure translates given Type to Term if this is possible.
Definition: parserHelpers.c:507
Any * createExists(Any *type, Any *term1, Any *term2)
The procedure creates the exists (i.e. existential quantifier introduction) proof term from given res...
Definition: parserHelpers.c:644
Definition: parserHelpers.h:43
Definition: parserHelpers.h:57
eType
Values to indicate different species of Type elements.
Definition: checker.h:84
Any * createAbstract(string name1, Any *type2, string name3, Any *type4, Any *term5, Any *term6)
The procedure creates the abstraction (i.e. existential quantifier elimination) proof term from given...
Definition: parserHelpers.c:616
The wrapper that makes it possible to store in envmap different species of elements that occur in typ...
Definition: checker.h:329
Name name
The actual location of the identifier.
Definition: parserHelpers.h:65
Any * typeToTerm(Any *mtype)
The procedure translates given Type to Term if this is possible.
Definition: parserHelpers.c:539
Any * createBasicBinary(eType kind, Any *arg1, Any *arg2)
The procedure creates a basic binary operator such as AND or OR.
Definition: parserHelpers.c:80
Definition: parserHelpers.h:41
The representation of the proof terms in the typesystem.
Definition: checker.h:298
Any * composeAnyType(eType tp, Any *first, Any *second)
The procedure composes a new type from the arguments and the kind of the type to be created...
Definition: parserHelpers.c:288
Any * createTuple(Any *type, Any *term1, Any *term2)
The procedure creates the tuple (i.e. conjunction introduction) proof term from given two product ter...
Definition: parserHelpers.c:736
Definition: parserHelpers.h:45
char * Name
The type to structurally represent identifier names.
Definition: checker.h:46
Definition: parserHelpers.h:53
Any * composeBinaryConnective(YYSTYPE res, Any *arg1, Any *arg2)
The procedure composes a new type from the arguments and the information on the expected result conta...
Definition: parserHelpers.c:123
Any * createCase(Any *term, McasIn *case1, McasIn *case2)
The procedure creates the case (i.e. alternative elimination) proof term from given implementation te...
Definition: parserHelpers.c:666
Definition: parserHelpers.h:35