InutitionTC
0.30
|
Functions that help making yacc file concise. More...
Go to the source code of this file.
Data Structures | |
struct | string |
A wrapper structure to pass along identifier names within the parser. More... | |
union | YYSTYPE |
The union type of the values passed as the return value in the parser. More... | |
Macros | |
#define | YYSTYPE_IS_DECLARED 1 |
The guard to make sure the union YYSTYPE is declared only once. | |
Typedefs | |
typedef struct string | string |
A wrapper structure to pass along identifier names within the parser. | |
Enumerations | |
enum | eAnyH { eAnyTypeH, eAnyTermH, eAnyKindH, eAnyNameH, eAnyBindH, eConnDoubleArrow, eConnRightArrow, eConnLeftArrow, eConnOr, eConnXor, eConnNor, eConnNand, eConnNot, eConnForall, eConnExists, eConnUnhandled } |
The type of the values located in the first field of the union YYSTYPE passed as the return value in the parser. More... | |
Functions | |
int | yyparse (void) |
The procedure parses the content of the file opened for parsing. More... | |
Any * | createBasicBinary (eType kind, Any *arg1, Any *arg2) |
The procedure creates a basic binary operator such as AND or OR. More... | |
Name | createWord (YYSTYPE *res) |
The procedure creates a string to be used as identifier. More... | |
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. More... | |
Any * | composeBinaryConnective (YYSTYPE res, Any *arg1, Any *arg2) |
The procedure composes a new type from the arguments and the information on the expected result contained in the YYSTYPE union in the first argument. More... | |
Any * | composeUnaryConnective (YYSTYPE res, Any *arg) |
The procedure composes a new type from the argument and unary connective prescribed in the YYSTYPE union in the first argument. More... | |
void | freeQChain (Type *start) |
The procedure frees memory of a quantifier chain allocated in composeQuantifier. More... | |
Any * | composeQuantifier (eAnyH tp, nameSet *ns, Any *formula) |
The procedure is used to create a formula that starts with either universal or existential quantifier. More... | |
Any * | composeTermVariable (string arg) |
The procedure is used to create Term in Any wrapper with variable the name of which is given in the argument string. More... | |
Any * | composeTypeVariable (string arg) |
The procedure is used to create Type in Any wrapper with variable the name of which is given in the argument string. More... | |
Any * | composeFunctorWithArguments (string name, envmap *arguments) |
The procedure creates a Type that is a predicate variable applied to the given sequence of arguments . More... | |
Any * | typeToTerm (Any *mtype) |
The procedure translates given Type to Term if this is possible. More... | |
Term * | typeToTermRaw (Type *mtype) |
The procedure translates given Type to Term if this is possible. More... | |
Any * | createExFalso (Any *term, Any *formula) |
The procedure creates the ex falso quod libet proof term from given Term and Type. More... | |
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. More... | |
Any * | createApp (Any *term1, Any *term2) |
The procedure creates the application proof term from given two Term terms. More... | |
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 two names of fresh variables, their types, implementation term and usage term. More... | |
Any * | createExists (Any *type, Any *term1, Any *term2) |
The procedure creates the exists (i.e. existential quantifier introduction) proof term from given result type, the witness term and the implementation term. More... | |
Any * | createCase (Any *term, McasIn *case1, McasIn *case2) |
The procedure creates the case (i.e. alternative elimination) proof term from given implementation term and cases. More... | |
Any * | createIn (Any *term, Any *type, int which) |
The procedure creates the injection (i.e. alternative introduction) proof term from given implementation and the resulting type. More... | |
Any * | createProj (Any *term, int which) |
The procedure creates the projection (i.e. conjunction elimination) proof term from given product term. More... | |
Any * | createTuple (Any *type, Any *term1, Any *term2) |
The procedure creates the tuple (i.e. conjunction introduction) proof term from given two product terms and type of the result. More... | |
Any * | createTermVar (string vname) |
The procedure creates the term variable proof term name of the variable. More... | |
McasIn * | createCaseTerm (string name, Any *type, Any *term) |
The procedure creates the case subexpression from given name of the variable, its type and the implementation term. More... | |
Name | getFreshName (envmap *env) |
The procedure creates a name that does not occur in the given environment. More... | |
Functions that help making yacc file concise.
enum eAnyH |
The type of the values located in the first field of the union YYSTYPE passed as the return value in the parser.
In some cases only this value is used to inform on which symbol has been encountered by the parser. The first 5 values match the ones of the enum type eAny.
Enumerator | |
---|---|
eAnyTypeH |
The value contains Type structure |
eAnyTermH |
The value contains Term structure |
eAnyKindH |
The value contains Kind structure |
eAnyNameH |
The value contains Name |
eAnyBindH |
The value contains Bind structure |
eConnDoubleArrow |
Information that equivalence symbol was encountered |
eConnRightArrow |
Information that implication symbol was encountered |
eConnLeftArrow |
Information that reverse implication symbol was encountered |
eConnOr |
Information that disjunction symbol was encountered |
eConnXor |
Information that XOR symbol was encountered |
eConnNor |
Information that NOR symbol was encountered |
eConnNand |
Information that NAND symbol was encountered |
eConnNot |
Information that negation symbol was encountered |
eConnForall |
Information that universal quantifier symbol was encountered |
eConnExists |
Information that existential quantifier symbol was encountered |
eConnUnhandled |
Information that unhandled symbol was encountered |
The procedure composes a new type from the arguments and the kind of the type to be created.
It checks if the arguments are indeed types. It handles currently only AND and OR types. All other kinds of types are not handled here and treated as errors.
tp | the kind of type to be created |
first | the first argument of the newly created type |
second | the second argument of the newly created type |
NULL
in case of error The procedure composes a new type from the arguments and the information on the expected result contained in the YYSTYPE union in the first argument.
It checks if the second and third arguments are indeed types. It handles currently: left arrow, right arrow, double arrow, NOR, NAND, OR. All other kinds of types, especially those that do not represent connectives or represent unary ones, are not handled here and treated as errors.
res | the structure for the expected return type |
arg1 | the first argument of the newly created type |
arg2 | the second argument of the newly created type |
NULL
in case of error The procedure creates a Type that is a predicate variable applied to the given sequence of arguments
.
The function creates a sequence of applications that starts with the type variable the name of which is given in name
parameter and arguments of which are stored in the arguments
parameter. It emits a message and returns NULL
on error.
The procedure is used to create a formula that starts with either universal or existential quantifier.
It checks if the given formula
is accessible and then gradually creates a series of formulas with bigger and bigger number of initial quantifiers. It uses the strings in ns
for the variable names to quantify for. In case tp
is not of an appropriate type it generates error.
tp | the variety of the quantifier formula to create |
ns | the set of names for the quantified variables |
formula | the Type that constitutes the body of the formula |
NULL
in case of error The procedure is used to create Term in Any wrapper with variable the name of which is given in the argument string.
The memory for the new representation is freshly allocated here and the content of the string is copied there.
arg | the string with name of the variable |
NULL
on error The procedure is used to create Type in Any wrapper with variable the name of which is given in the argument string.
The memory for the new representation is freshly allocated here and the content of the string is copied there.
arg | the string with name of the variable |
NULL
on error The procedure composes a new type from the argument and unary connective prescribed in the YYSTYPE union in the first argument.
It checks if the second argument is indeed a type. It handles currently negation only. All other kinds of types, especially those that do not represent connectives or represent binary ones, are not handled here and treated as errors.
res | the structure for the expected return type |
arg | the argument of the newly created type |
NULL
in case of error 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 two names of fresh variables, their types, implementation term and usage term.
The procedure checks shallowly if the arguments are correctly formed and creates abstraction term proof (i.e. existential quantifier elimination term) which is subsequently wrapped in an Any structure. Note that we do not check the logical structure here.
name1 | the string with the name of the abstracted object |
type2 | the type of the abstracted object |
name3 | the string with the name of the abstracted implementation |
type4 | the type of the abstracted implementation |
term5 | the term with the abstracted implementation |
term6 | the term which used the abstracted implementation |
NULL
on error The procedure creates the application proof term from given two Term terms.
The procedure checks shallowly if the arguments are correctly formed and creates application term proof which is subsequently wrapped in an Any structure. Note that we do not check the logical structure here.
term1 | the operand term |
term2 | the argument term |
NULL
on error The procedure creates a basic binary operator such as AND or OR.
It allocates fresh memory for the new Type to represent the operator as well as Any container for the type. The arguments of the type are retrieved from arg1 and arg2 Any arguments. It does not check if the arguments are well formed, but it checks if local operations (allocation and filling the arguments) are correct.
kind | the kind of the binary operator to create |
arg1 | the first argument of the operator |
arg2 | the second argument of the operator |
NULL
in case of error, it emits error message in case of error The procedure creates the case (i.e. alternative elimination) proof term from given implementation term and cases.
The procedure checks shallowly if the arguments are correctly formed and creates case term proof (i.e. alternative elimination term) which is subsequently wrapped in an Any structure. Note that we do not check the logical structure here.
term | the implementation term of the alternative elimination |
case1 | the case expression to handle the first option of the alternative |
case2 | the case expression to handle the second option of the alternative |
NULL
on error The procedure creates the case subexpression from given name of the variable, its type and the implementation term.
The procedure checks shallowly if the arguments are correctly formed and creates case subexpression that is subsequently used in creation of case proofs (i.e. alternative elimination proof terms). Note that we do not check the logical structure here.
name | the name of the case analysed term when it matches the current case |
term1 | the type of the current case |
term2 | the term that realises handling of the current case |
NULL
on error The procedure creates the ex falso quod libet proof term from given Term and Type.
The procedure checks shallowly if the arguments are correctly formed and creates ex falso quod libet proof term which is subsequently wrapped in an Any structure. Note that we do not check the logical structure here. In particular term
parameter need not be a proof of falsity here.
NULL
on error The procedure creates the exists (i.e. existential quantifier introduction) proof term from given result type, the witness term and the implementation term.
The procedure checks shallowly if the arguments are correctly formed and creates exists term proof (i.e. existential quantifier introduction term) which is subsequently wrapped in an Any structure. Note that we do not check the logical structure here.
type | the existential type of the resulting term |
term1 | the witness term of the existential quantifier introduction |
term1 | the implementation term of the existential quantifier introduction |
NULL
on error The procedure creates the injection (i.e. alternative introduction) proof term from given implementation and the resulting type.
The procedure checks shallowly if the arguments are correctly formed and creates injection term proof (i.e. alternative introduction term) which is subsequently wrapped in an Any structure. Note that we do not check the logical structure here.
term | the implementation term of the alternative introduction |
type | the type of the resulting term |
which | information on which of the two injections is created (it is equal to either 1 or 2) |
NULL
on error The procedure creates the lambda proof term from given Name of the argument, its Type and body Term.
The procedure checks shallowly if the arguments are correctly formed and creates lambda term proof which is subsequently wrapped in an Any structure. Note that we do not check the logical structure here.
vname | the string with the name of the argument variable |
vtype | the Type of the argument |
term | the Term with the body of the lambda term |
NULL
on error The procedure creates the projection (i.e. conjunction elimination) proof term from given product term.
The procedure checks shallowly if the arguments are correctly formed and creates projection term proof (i.e. conjunction elimination term) which is subsequently wrapped in an Any structure. Note that we do not check the logical structure here.
term | the product term of the conjunction elimination |
which | information on which of the two projections is created (it is equal to either 1 or 2) |
NULL
on error The procedure creates the term variable proof term name of the variable.
The procedure creates term variable proof (i.e. axiom proof term) which is subsequently wrapped in an Any structure. Note that we do not check the logical structure here.
vname | the name of the term variable |
NULL
on error The procedure creates the tuple (i.e. conjunction introduction) proof term from given two product terms and type of the result.
The procedure checks shallowly if the arguments are correctly formed and creates tuple term proof (i.e. conjunction introduction term) which is subsequently wrapped in an Any structure. Note that we do not check the logical structure here.
type | the type of the result |
term1 | the term that becomes the first coordinate of the tuple |
term2 | the term that becomes the second coordinate of the tuple |
NULL
on error The procedure creates a string to be used as identifier.
It allocates fresh memory for the new Name and copies there the content of the lexing global variable #yytext.
res | the YYSTYPE union to store the pointer to the identifier string to |
NULL
in case of allocation error void freeQChain | ( | Type * | start | ) |
The procedure frees memory of a quantifier chain allocated in composeQuantifier.
start | pointer to chain of quantifiers |
The procedure creates a name that does not occur in the given environment.
env | the environment to guarantee freshness against |
The procedure translates given Type to Term if this is possible.
The procedure checks if the argument is properly formed and wraps the result in Any structure. The actual work is done in typeToTermRaw(). The procedure works for a type variable applied to its arguments. Some parsing within the TPTP parser is common for both types and terms and we have to translate one to the other when the initial assumption that the construct is a type turns out to be wrong.
int yyparse | ( | void | ) |
The procedure parses the content of the file opened for parsing.
The code of the function is automatically generated by yacc and flex from syntaxAnalyser.y and lexicalAnalyzer.l files.