Package com.articulate.sigma.parsing
Class VarTypes
java.lang.Object
com.articulate.sigma.parsing.VarTypes
Determine the types of variables by their appearance in relations,
as well as whether constants or functions are allowed given their types
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionconstrainVars(String rel, String var, FormulaAST f) Constrain variables found in the argument list of a predicate variable where the relation 'rel' will be substitutedvoidGo through the equation map of a formula.voidif a relation is used as an argument, add a suffix to that constant in the literal for the constant list.voidGo through the argument map of a formula, which consists of all predicates and their arguments in each position, within this formula, and find the type of that argument.findTypeOfFunterm(com.articulate.sigma.parsing.SuokifParser.FuntermContext input) funterm : '(' FUNWORD argument+ ')' ; argument : (sentence | term) ;findTypeOfTerm(com.articulate.sigma.parsing.SuokifParser.TermContext input, String sigType) term : (funterm | variable | string | number | FUNWORD | IDENTIFIER ) ; Since types are not instances, always remove any trailing '+' denoting a classvoidbooleanfunctionSpecializationAllowed(org.antlr.v4.runtime.tree.ParseTree c, String sigTypeNoSuffix) The type specialization of MeasureFn is a special case funterm : '(' FUNWORD argument+ ')' ; argument : (sentence | term) ; term : (funterm | variable | string | number | FUNWORD | IDENTIFIER ) ;voidprintContexts(Map<Integer, Set<com.articulate.sigma.parsing.SuokifParser.ArgumentContext>> args)
-
Field Details
-
debug
public boolean debug
-
-
Constructor Details
-
VarTypes
-
-
Method Details
-
findTypeOfFunterm
funterm : '(' FUNWORD argument+ ')' ; argument : (sentence | term) ; -
findTypeOfTerm
public String findTypeOfTerm(com.articulate.sigma.parsing.SuokifParser.TermContext input, String sigType) term : (funterm | variable | string | number | FUNWORD | IDENTIFIER ) ; Since types are not instances, always remove any trailing '+' denoting a class -
findEquationType
Go through the equation map of a formula. If the argument is a variable, add the type to the variable type map (varTypeMap) by finding the type of the other argument eqsent : '(' 'equal' term term ')' ; term : (funterm | variable | string | number | FUNWORD | IDENTIFIER ) ; -
constrainVars
Constrain variables found in the argument list of a predicate variable where the relation 'rel' will be substituted -
functionSpecializationAllowed
public boolean functionSpecializationAllowed(org.antlr.v4.runtime.tree.ParseTree c, String sigTypeNoSuffix) The type specialization of MeasureFn is a special case funterm : '(' FUNWORD argument+ ')' ; argument : (sentence | term) ; term : (funterm | variable | string | number | FUNWORD | IDENTIFIER ) ; -
findRelationsAsArgs
if a relation is used as an argument, add a suffix to that constant in the literal for the constant list. It will be used later in conversion to TPTP. -
findType
Go through the argument map of a formula, which consists of all predicates and their arguments in each position, within this formula, and find the type of that argument. If the argument is a variable, add the type to the variable type map (varTypeMap). If the argument is not a variable, make sure it is allowed as a argument, given the signature of the predicate. If not, report an error. Handling functions that are arguments requires a special case to call findTypeOfFunterm. MeasureFn is a special case of function arguments since the type of the measure indicates the return type of the function. argument : (sentence | term) ; sentence : (relsent | logsent | quantsent | variable) ; term : (funterm | variable | string | number | FUNWORD | IDENTIFIER ) ; -
printContexts
-
findTypes
public void findTypes()
-