|
Algernon Software | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.algernon.aam.compile.AlgernonCompiler
This class compiles Algernon expressions into AAM abstract machine opcodes.
Constructor Summary | |
AlgernonCompiler(Algernon algy)
|
Method Summary | |
void |
checkForObsoleteMacro(LispValue macro,
LispValue clause,
ErrorSet errors)
check for obsolete macro - puts a warning message in the error set. |
LispValue |
compile(Path path,
AlgernonKBSet kbSet,
int compileMode,
BindingList bindings,
Map argumentTypes,
Rule rule,
AlgernonCompilerState compileState,
ErrorSet compileErrors)
Returns a list of AAM machine code to be executed. |
protected LispValue |
compileAssert(Clause clause,
AlgernonKBSet kbSet,
int index,
BindingList bindings,
Map argumentTypes,
Rule rule,
AlgernonCompilerState compileState,
LispValue code,
ErrorSet compileErrors)
compile-assert |
protected LispValue |
compileClause(Clause clause,
AlgernonKBSet kbSet,
int index,
int compileMode,
BindingList bindings,
Map argumentTypes,
Rule rule,
AlgernonCompilerState compileState,
LispValue code,
ErrorSet compileErrors)
compiles one clause |
protected LispValue |
compileMacro(Clause clause,
AlgernonKBSet kbSet,
int index,
int compileMode,
BindingList bindings,
Map argumentTypes,
Rule rule,
AlgernonCompilerState compileState,
LispValue code,
ErrorSet compileErrors)
|
protected LispValue |
compileOpAddClass(Clause clause,
AlgernonKBSet kbSet,
int compileMode,
BindingList bindings,
Map argumentTypes,
Rule rule,
AlgernonCompilerState compileState,
LispValue code,
ErrorSet compileErrors)
create a new frame and assert the path for that variable. |
protected LispValue |
compileOpAddInstance(Clause clause,
AlgernonKBSet kbSet,
int compileMode,
BindingList bindings,
Map argumentTypes,
Rule rule,
AlgernonCompilerState compileState,
LispValue code,
ErrorSet compileErrors)
|
protected LispValue |
compileOpAllPaths(Clause clause,
AlgernonKBSet kbSet,
int compileMode,
BindingList bindings,
Map argumentTypes,
Rule rule,
AlgernonCompilerState compileState,
LispValue code,
ErrorSet compileErrors)
|
protected LispValue |
compileOpAny(Clause clause,
AlgernonKBSet kbSet,
int compileMode,
BindingList bindings,
Map argumentTypes,
Rule rule,
AlgernonCompilerState compileState,
LispValue code,
ErrorSet compileErrors)
|
protected LispValue |
compileOpAsk(Clause clause,
AlgernonKBSet kbSet,
int compileMode,
BindingList bindings,
Map argumentTypes,
Rule rule,
AlgernonCompilerState compileState,
LispValue code,
ErrorSet compileErrors)
|
protected LispValue |
compileOpCount(Clause clause,
AlgernonKBSet kbSet,
int compileMode,
BindingList bindings,
Map argumentTypes,
Rule rule,
AlgernonCompilerState compileState,
LispValue code,
ErrorSet compileErrors)
This compiles the :COUNT macro. |
protected LispValue |
compileOpDelete(Clause clause,
AlgernonKBSet kbSet,
int compileMode,
BindingList bindings,
Map argumentTypes,
Rule rule,
AlgernonCompilerState compileState,
LispValue code,
ErrorSet compileErrors)
|
protected LispValue |
compileOpFail(Clause clause,
AlgernonKBSet kbSet,
int compileMode,
BindingList bindings,
Map argumentTypes,
Rule rule,
AlgernonCompilerState compileState,
LispValue code,
ErrorSet compileErrors)
This compiles the :FAIL and :UNP macros (which are synonyms of each other). |
protected LispValue |
compileOpFire(Clause clause,
AlgernonKBSet kbSet,
int compileMode,
BindingList bindings,
Map argumentTypes,
Rule rule,
AlgernonCompilerState compileState,
LispValue code,
ErrorSet compileErrors)
|
protected LispValue |
compileOpFor(Clause clause,
AlgernonKBSet kbSet,
int compileMode,
BindingList bindings,
Map argumentTypes,
Rule rule,
AlgernonCompilerState compileState,
LispValue code,
ErrorSet compileErrors)
This compiles the :FOR macro. |
protected LispValue |
compileOpForcClass(Clause clause,
AlgernonKBSet kbSet,
int compileMode,
BindingList bindings,
Map argumentTypes,
Rule rule,
AlgernonCompilerState compileState,
LispValue code,
ErrorSet compileErrors)
|
protected LispValue |
compileOpForcInstance(Clause clause,
AlgernonKBSet kbSet,
int compileMode,
BindingList bindings,
Map argumentTypes,
Rule rule,
AlgernonCompilerState compileState,
LispValue code,
ErrorSet compileErrors)
|
protected LispValue |
compileOpLimit(Clause clause,
AlgernonKBSet kbSet,
int compileMode,
BindingList bindings,
Map argumentTypes,
Rule rule,
AlgernonCompilerState compileState,
LispValue code,
ErrorSet compileErrors)
This compiles the :LIMIT macro. |
protected LispValue |
compileOpOr(Clause clause,
AlgernonKBSet kbSet,
int compileMode,
BindingList bindings,
Map argumentTypes,
Rule rule,
AlgernonCompilerState compileState,
LispValue code,
ErrorSet compileErrors)
|
protected LispValue |
compileOpPrint(Clause clause,
AlgernonKBSet kbSet,
int index,
BindingList bindings,
Map argumentTypes,
Rule rule,
AlgernonCompilerState compileState,
LispValue code,
ErrorSet compileErrors,
boolean newline)
compileOpPrint - compiles the PRINT and PRINTLN macros. |
protected LispValue |
compileOpTheClass(Clause clause,
AlgernonKBSet kbSet,
int compileMode,
BindingList bindings,
Map argumentTypes,
Rule rule,
AlgernonCompilerState compileState,
LispValue code,
ErrorSet compileErrors)
|
protected LispValue |
compileOpTheInstance(Clause clause,
AlgernonKBSet kbSet,
int compileMode,
BindingList bindings,
Map argumentTypes,
Rule rule,
AlgernonCompilerState compileState,
LispValue code,
ErrorSet compileErrors)
|
protected LispValue |
compilePath(Path path,
AlgernonKBSet kbSet,
int index,
int compileMode,
BindingList bindings,
Map argumentTypes,
Rule rule,
AlgernonCompilerState compileState,
ErrorSet compileErrors)
compilePath compiles an Algernon path into abstract machine code. |
protected LispValue |
compilePathAux(Path path,
AlgernonKBSet kbSet,
int index,
int compileMode,
BindingList bindings,
Map argumentTypes,
Rule rule,
AlgernonCompilerState compileState,
LispValue code,
ErrorSet compileErrors)
compilePathAux is an internal routine that compiles a path. |
protected LispValue |
compilePathNoReturn(Path path,
AlgernonKBSet kbSet,
int index,
int compileMode,
BindingList bindings,
Map argumentTypes,
Rule rule,
AlgernonCompilerState compileState,
ErrorSet compileErrors)
compilePathAux is an internal routine that compiles a path. |
protected LispValue |
compileQuery(Clause clause,
AlgernonKBSet kbSet,
int index,
BindingList bindings,
Map argumentTypes,
Rule rule,
AlgernonCompilerState compileState,
LispValue code,
ErrorSet compileErrors)
compileQuery |
Collection |
compileRule(Rule rule,
AlgernonKBSet kbSet,
BindingList bindings,
Map argTypes,
AlgernonCompilerState compileState,
int startIndex,
ErrorSet errors)
Compiles a rule. |
protected LispValue |
compileSpecial(Clause clause,
AlgernonKBSet kbSet,
int index,
BindingList bindings,
Map argumentTypes,
Rule rule,
AlgernonCompilerState compileState,
LispValue code,
ErrorSet compileErrors)
compileSpecial - general-purpose routine for special MACROS whose details are handled by the opcode. |
protected LispValue |
compileSpecialWithFail(Clause clause,
AlgernonKBSet kbSet,
int index,
BindingList bindings,
Map argumentTypes,
Rule rule,
AlgernonCompilerState compileState,
LispValue code,
ErrorSet compileErrors)
compileSpecialWithFail - general-purpose routine for special MACROS that need to check for failure afterward. |
protected LispValue |
compileSpecialWithFailAndMerge(Clause clause,
AlgernonKBSet kbSet,
int index,
BindingList bindings,
Map argumentTypes,
Rule rule,
AlgernonCompilerState compileState,
LispValue code,
ErrorSet compileErrors)
compileSpecialWithFailAndMerge - general-purpose routine for special MACROS that need to check for failure afterward. |
protected LispValue |
compileSpecialWithMerge(Clause clause,
AlgernonKBSet kbSet,
int index,
BindingList bindings,
Map argumentTypes,
Rule rule,
AlgernonCompilerState compileState,
LispValue code,
ErrorSet compileErrors)
compileSpecialWithMerge - general-purpose routine for special MACROS that need to do a merge-bindings afterward. |
protected LispValue |
compileSubroutine(LispValue variable,
Path path,
AlgernonKBSet kbSet,
int compileMode,
BindingList bindings,
Map argumentTypes,
Rule rule,
AlgernonCompilerState compileState,
ErrorSet compileErrors)
compiles a subroutine. |
protected LispValue |
compileVerify(Clause clause,
AlgernonKBSet kbSet,
int index,
BindingList bindings,
Map argumentTypes,
Rule rule,
AlgernonCompilerState compileState,
LispValue code,
ErrorSet compileErrors)
compileVerify |
protected boolean |
constantTypeEQ(AlgernonKBSet kbSet,
LispValue argument,
Set type,
Clause form,
AlgernonCompilerState compileState,
ErrorSet compileErrors)
|
String |
deprecationWarning(LispValue oldOperator,
String message,
LispValue clause)
General deprecation warning for old operators. |
String |
domainMismatchWarning(Clause clause,
LispValue argument,
Set variableType,
Set desiredType)
Returns an error about type mismatch on variables. |
protected LispValue |
doTaxonomyPreprocess(LispValue superclass,
LispValue forms,
BindingList bindings)
This turns the TAXONOMY form into the :CLASS and :INSTANCE pseudo-code that is processed by makeTaxonomyCommands. |
Opcode |
findOpcodeForMacro(LispValue macro)
Send in a macro name (that is, a keyword). |
LispValue |
generateRuleCode(Rule rule,
AlgernonKBSet kbSet,
int direction,
Path antecedent,
Path consequent,
int index,
Rule rootRule,
BindingList boundVariables,
Map argumentTypes,
ErrorSet errors)
Generates the actual code for the rule. |
protected String |
generateRuleName(Rule rule,
BindingList variableSet)
Generates a fake rule name based on the set of bound variables. |
protected Collection |
generateVariableSets(Clause clause)
When a backward chaining rule is activated, some number of variables in the key will be bound. |
protected LispValue |
getNewConjunctionID()
Generate a new label. |
protected LispValue |
getNewLabel()
Generate a new label. |
protected LispValue |
getNewVariable()
Generate a new variable. |
private boolean |
hasInvalidArgumentCount(LispValue command,
int numberOfArguments,
int requiredNumber)
Checks the argument count against the requirements. |
protected void |
implicitTypeRestrict(AlgernonKBSet kbSet,
Clause clause,
Map argumentTypes,
AlgernonCompilerState compileState,
ErrorSet compileErrors)
Added 29 Sep 1999 (mh) Added type restriction - if the path contains an ISA or MEMBER clause, this information is used to restrict the type to a new type, eliminating some unnecessary warning messages The clause should NOT be negated. |
void |
initializeArgumentTypes(AlgernonKBSet kbSet,
Map typeList,
Path path,
AlgernonCompilerState compileState,
ErrorSet errors,
boolean clear)
The compiler type-checks each clause. |
protected void |
initializeConstants()
variable initializer for this class. |
boolean |
isContinuable(Clause clause)
Returns true if continuations should be created for the given operation. |
boolean |
isFrameType(Set variableType)
|
boolean |
isMacro(LispValue symbol)
Returns true if the given symbol is an Algernon special form. |
boolean |
isOfSimpleType(LispValue arg,
Set type)
Returns true if the argument satisfies the simple type. |
boolean |
isPathUnrestricted(LispValue symbol)
Returns true if the given symbol is not required to follow the Algernon path restrictions. |
boolean |
isSimpleType(LispValue type)
Returns true if the type is not a frame type. |
boolean |
isSimpleType(Set types)
Returns true if the type set contains only simple types. |
protected Set |
lookupArgumentType(LispValue argument,
Map argumentTypes)
Returns a set of argument types for an argument. |
protected Path |
makeTaxonomyCommands(AlgernonKBSet kbSet,
LispValue pseudoTax,
BindingList bindings)
Converts pseudo-taxonomy commands into real taxonomy commands. |
String |
pathRestrictionWarning(Clause clause,
Rule rule)
Returns a warning about path restriction. |
Clause |
preprocessClause(Clause clause)
Preprocesses a clause. |
Path |
preprocessPath(Path path)
Preprocesses a path |
protected Path |
preprocessTaxonomy(AlgernonKBSet kbSet,
LispValue form)
preprocesses the :TAXONOMY form to turn it into a set of :THE-CLASS and :THE-INSTANCE commands. |
String |
relationLengthMismatchError(int type,
Clause clause,
LispValue slot)
|
void |
setDebug(boolean state)
Set to true to turn on compiler debug mode. |
private void |
trace(String message)
|
protected boolean |
typeEQ(AlgernonKBSet kbSet,
LispValue argument,
Set type,
Map argumentTypes,
Clause form,
AlgernonCompilerState compileState,
ErrorSet compileErrors)
Checks for equality and stores the type, if not previously known. |
boolean |
typesIntersect(AlgernonKBSet kbSet,
Set types1,
Set types2)
Returns true if the two Sets of types intersect. |
boolean |
typeSubsumedBy(AlgernonKBSet kbSet,
LispValue singleType,
Set types)
Returns true if one frame type is a subclass or equal to any of a set of frame types. |
String |
undefinedRelationError(Clause clause,
LispValue slot)
|
String |
undeterminedDomainWarning(Clause clause,
LispValue argument,
Set type)
|
String |
unrecognizedOperatorError(Clause clause,
LispValue slot)
Returns an error string about an unrecognized command used in an Algernon clause. |
protected void |
validateArgumentTypes(Clause clause,
AlgernonKBSet kbSet,
Map argumentTypes,
AlgernonCompilerState compileState,
ErrorSet compileErrors)
validates that arguments are of the correct type. |
protected void |
validateMacroArgumentTypes(Clause form,
AlgernonKBSet kbSet,
Map argumentTypes,
AlgernonCompilerState compileState,
ErrorSet compileErrors)
Validates argument types for macros like :INSTANCE, :CLASS, and so on. |
protected void |
validateSpecialFormArgumentTypes(Clause form,
AlgernonKBSet kbSet,
Map argumentTypes,
AlgernonCompilerState compileState,
ErrorSet compileErrors)
Validates argument types for macros like :THE, :A and :FORC, which have different forms of arguments. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int ASSERT_MODE
public static final int QUERY_MODE
public static final int VERIFY_MODE
protected static final int FORC_MODE
protected static final int NORMAL_MODE
protected static final int TOO_FEW_ARGS
protected static final int TOO_MANY_ARGS
protected static final int ZERO_OR_MORE
protected static final boolean NEWLINE
protected static final boolean NO_NEWLINE
private boolean DEBUG
protected LispValue TAX_CLASS
protected LispValue TAX_INSTANCE
protected LispValue TAX_COMPLETE
public LispValue UNTYPED_VAR
public LispValue ALL_LABEL
public LispValue END_LABEL
public LispValue FAIL_LABEL
public LispValue SUCCEED_LABEL
public Command OP_A
public Command OP_ADD_CLASS
public Command OP_ADD_FACET
public Command OP_ADD_INSTANCE
public Command OP_ADD_RULE
public Command OP_ADD_RELATION
public Command OP_ADD_RELATION_RULE
public Command OP_ALL_PATHS
public Command OP_ALL_PATHS_PART_1
public Command OP_ALL_PATHS_PART_2
public Command OP_ANY
public Command OP_ASK
public Command OP_ASSUME
public Command OP_BIND
public Command OP_BOUNDP
public Command OP_BRANCH
public Command OP_CHILD
public Command OP_CLASS
public Command OP_CLEAR_RELATION
public Command OP_CLEAR_SLOT
public Command OP_LEAST_COMMON_SUPERCLASS
public Command OP_COUNT
public Command OP_DATE
public Command OP_DELETE
public Command OP_DELETE_CLASS
public Command OP_DELETE_FACET
public Command OP_DELETE_FRAME
public Command OP_DELETE_INSTANCE
public Command OP_DELETE_RELATION
public Command OP_DIRECT_CLASS
public Command OP_DIRECT_INSTANCE
public Command OP_DIRECT_SUBCLASS
public Command OP_DIRECT_SUPERCLASS
public Command OP_EVAL
public Command OP_FAIL
public Command OP_FIRE
public Command OP_FOR
public Command OP_FORC
public Command OP_FORC_CLASS
public Command OP_FORC_INSTANCE
public Command OP_INSTANCE
public Command OP_IS_CLASS
public Command OP_IS_FACET
public Command OP_IS_FRAME
public Command OP_IS_INSTANCE
public Command OP_IS_RELATION
public Command OP_LEAF_CLASS
public Command OP_LIMIT
public Command OP_NAME
public Command OP_NEQ
public Command OP_NO_COMPLETION
public Command OP_NO_CONTINUATION
public Command OP_OR
public Command OP_PARENT
public Command OP_PRINT
public Command OP_PRINTLN
public Command OP_RETRIEVE
public Command OP_ROOT_CLASS
public Command OP_RULES
public Command OP_SHOW
public Command OP_SHOW_CODE
public Command OP_SLOT
public Command OP_SRULES
public Command OP_STOP
public Command OP_SUBCLASS
public Command OP_SUPERCLASS
public Command OP_TAXONOMY
public Command OP_TEST
public Command OP_TEMPLATE_RELATION
public Command OP_THE
public Command OP_THE_CLASS
public Command OP_THE_INSTANCE
public Command OP_TRACE
public Command OP_UNBOUNDP
public Command OP_UNP
public Command OP_USE_KB
protected LispValue STANDARD_CODE_TAIL
protected LispValue STANDARD_RULE_CODE_TAIL
protected Algernon f_algy
protected static int m_conjunctionIDCounter
protected static int m_labelCounter
protected static int m_variableCounter
protected static DecimalFormat m_labelFormat
private Jatha f_lisp
private Processor f_processor
private OpcodeSet f_opcodeSet
Constructor Detail |
public AlgernonCompiler(Algernon algy)
Method Detail |
protected void initializeConstants()
public boolean isMacro(LispValue symbol)
public boolean isPathUnrestricted(LispValue symbol)
public boolean isContinuable(Clause clause)
public void checkForObsoleteMacro(LispValue macro, LispValue clause, ErrorSet errors)
public Opcode findOpcodeForMacro(LispValue macro) throws AlgernonCompilerException
AlgernonCompilerException
protected LispValue getNewConjunctionID()
protected LispValue getNewLabel()
protected LispValue getNewVariable()
public LispValue compile(Path path, AlgernonKBSet kbSet, int compileMode, BindingList bindings, Map argumentTypes, Rule rule, AlgernonCompilerState compileState, ErrorSet compileErrors) throws AlgernonException
AlgernonException
protected LispValue compilePath(Path path, AlgernonKBSet kbSet, int index, int compileMode, BindingList bindings, Map argumentTypes, Rule rule, AlgernonCompilerState compileState, ErrorSet compileErrors) throws AlgernonException
AlgernonException
protected LispValue compilePathNoReturn(Path path, AlgernonKBSet kbSet, int index, int compileMode, BindingList bindings, Map argumentTypes, Rule rule, AlgernonCompilerState compileState, ErrorSet compileErrors) throws AlgernonException
AlgernonException
protected LispValue compilePathAux(Path path, AlgernonKBSet kbSet, int index, int compileMode, BindingList bindings, Map argumentTypes, Rule rule, AlgernonCompilerState compileState, LispValue code, ErrorSet compileErrors) throws AlgernonException
AlgernonException
protected LispValue compileClause(Clause clause, AlgernonKBSet kbSet, int index, int compileMode, BindingList bindings, Map argumentTypes, Rule rule, AlgernonCompilerState compileState, LispValue code, ErrorSet compileErrors) throws AlgernonException
AlgernonException
protected LispValue compileSubroutine(LispValue variable, Path path, AlgernonKBSet kbSet, int compileMode, BindingList bindings, Map argumentTypes, Rule rule, AlgernonCompilerState compileState, ErrorSet compileErrors) throws AlgernonException
AlgernonException
protected LispValue compileSpecial(Clause clause, AlgernonKBSet kbSet, int index, BindingList bindings, Map argumentTypes, Rule rule, AlgernonCompilerState compileState, LispValue code, ErrorSet compileErrors) throws AlgernonCompilerException
AlgernonCompilerException
protected LispValue compileSpecialWithFailAndMerge(Clause clause, AlgernonKBSet kbSet, int index, BindingList bindings, Map argumentTypes, Rule rule, AlgernonCompilerState compileState, LispValue code, ErrorSet compileErrors) throws AlgernonCompilerException
AlgernonCompilerException
protected LispValue compileSpecialWithFail(Clause clause, AlgernonKBSet kbSet, int index, BindingList bindings, Map argumentTypes, Rule rule, AlgernonCompilerState compileState, LispValue code, ErrorSet compileErrors) throws AlgernonCompilerException
AlgernonCompilerException
protected LispValue compileSpecialWithMerge(Clause clause, AlgernonKBSet kbSet, int index, BindingList bindings, Map argumentTypes, Rule rule, AlgernonCompilerState compileState, LispValue code, ErrorSet compileErrors) throws AlgernonCompilerException
AlgernonCompilerException
protected LispValue compileAssert(Clause clause, AlgernonKBSet kbSet, int index, BindingList bindings, Map argumentTypes, Rule rule, AlgernonCompilerState compileState, LispValue code, ErrorSet compileErrors)
protected LispValue compileQuery(Clause clause, AlgernonKBSet kbSet, int index, BindingList bindings, Map argumentTypes, Rule rule, AlgernonCompilerState compileState, LispValue code, ErrorSet compileErrors)
protected LispValue compileVerify(Clause clause, AlgernonKBSet kbSet, int index, BindingList bindings, Map argumentTypes, Rule rule, AlgernonCompilerState compileState, LispValue code, ErrorSet compileErrors)
protected LispValue compileMacro(Clause clause, AlgernonKBSet kbSet, int index, int compileMode, BindingList bindings, Map argumentTypes, Rule rule, AlgernonCompilerState compileState, LispValue code, ErrorSet compileErrors) throws AlgernonException
AlgernonException
protected LispValue compileOpAllPaths(Clause clause, AlgernonKBSet kbSet, int compileMode, BindingList bindings, Map argumentTypes, Rule rule, AlgernonCompilerState compileState, LispValue code, ErrorSet compileErrors) throws AlgernonException
AlgernonException
protected LispValue compileOpAny(Clause clause, AlgernonKBSet kbSet, int compileMode, BindingList bindings, Map argumentTypes, Rule rule, AlgernonCompilerState compileState, LispValue code, ErrorSet compileErrors) throws AlgernonException
AlgernonException
protected LispValue compileOpAsk(Clause clause, AlgernonKBSet kbSet, int compileMode, BindingList bindings, Map argumentTypes, Rule rule, AlgernonCompilerState compileState, LispValue code, ErrorSet compileErrors) throws AlgernonException
AlgernonException
protected LispValue compileOpAddClass(Clause clause, AlgernonKBSet kbSet, int compileMode, BindingList bindings, Map argumentTypes, Rule rule, AlgernonCompilerState compileState, LispValue code, ErrorSet compileErrors) throws AlgernonException
AlgernonException
protected LispValue compileOpCount(Clause clause, AlgernonKBSet kbSet, int compileMode, BindingList bindings, Map argumentTypes, Rule rule, AlgernonCompilerState compileState, LispValue code, ErrorSet compileErrors) throws AlgernonException
AlgernonException
protected LispValue compileOpDelete(Clause clause, AlgernonKBSet kbSet, int compileMode, BindingList bindings, Map argumentTypes, Rule rule, AlgernonCompilerState compileState, LispValue code, ErrorSet compileErrors) throws AlgernonException
AlgernonException
protected LispValue compileOpFail(Clause clause, AlgernonKBSet kbSet, int compileMode, BindingList bindings, Map argumentTypes, Rule rule, AlgernonCompilerState compileState, LispValue code, ErrorSet compileErrors) throws AlgernonException
AlgernonException
protected LispValue compileOpFire(Clause clause, AlgernonKBSet kbSet, int compileMode, BindingList bindings, Map argumentTypes, Rule rule, AlgernonCompilerState compileState, LispValue code, ErrorSet compileErrors)
protected LispValue compileOpFor(Clause clause, AlgernonKBSet kbSet, int compileMode, BindingList bindings, Map argumentTypes, Rule rule, AlgernonCompilerState compileState, LispValue code, ErrorSet compileErrors) throws AlgernonException
AlgernonException
protected LispValue compileOpLimit(Clause clause, AlgernonKBSet kbSet, int compileMode, BindingList bindings, Map argumentTypes, Rule rule, AlgernonCompilerState compileState, LispValue code, ErrorSet compileErrors) throws AlgernonException
AlgernonException
protected LispValue compileOpPrint(Clause clause, AlgernonKBSet kbSet, int index, BindingList bindings, Map argumentTypes, Rule rule, AlgernonCompilerState compileState, LispValue code, ErrorSet compileErrors, boolean newline) throws AlgernonCompilerException
AlgernonCompilerException
protected LispValue compileOpForcClass(Clause clause, AlgernonKBSet kbSet, int compileMode, BindingList bindings, Map argumentTypes, Rule rule, AlgernonCompilerState compileState, LispValue code, ErrorSet compileErrors) throws AlgernonException
AlgernonException
protected LispValue compileOpForcInstance(Clause clause, AlgernonKBSet kbSet, int compileMode, BindingList bindings, Map argumentTypes, Rule rule, AlgernonCompilerState compileState, LispValue code, ErrorSet compileErrors) throws AlgernonException
AlgernonException
protected LispValue compileOpAddInstance(Clause clause, AlgernonKBSet kbSet, int compileMode, BindingList bindings, Map argumentTypes, Rule rule, AlgernonCompilerState compileState, LispValue code, ErrorSet compileErrors) throws AlgernonException
AlgernonException
protected LispValue compileOpOr(Clause clause, AlgernonKBSet kbSet, int compileMode, BindingList bindings, Map argumentTypes, Rule rule, AlgernonCompilerState compileState, LispValue code, ErrorSet compileErrors) throws AlgernonException
AlgernonException
protected LispValue compileOpTheClass(Clause clause, AlgernonKBSet kbSet, int compileMode, BindingList bindings, Map argumentTypes, Rule rule, AlgernonCompilerState compileState, LispValue code, ErrorSet compileErrors) throws AlgernonException
AlgernonException
protected LispValue compileOpTheInstance(Clause clause, AlgernonKBSet kbSet, int compileMode, BindingList bindings, Map argumentTypes, Rule rule, AlgernonCompilerState compileState, LispValue code, ErrorSet compileErrors) throws AlgernonException
AlgernonException
public Path preprocessPath(Path path) throws AlgernonException
AlgernonException
public Clause preprocessClause(Clause clause) throws AlgernonException
AlgernonException
protected void validateArgumentTypes(Clause clause, AlgernonKBSet kbSet, Map argumentTypes, AlgernonCompilerState compileState, ErrorSet compileErrors) throws AlgernonDataException
AlgernonDataException
protected void validateSpecialFormArgumentTypes(Clause form, AlgernonKBSet kbSet, Map argumentTypes, AlgernonCompilerState compileState, ErrorSet compileErrors) throws AlgernonDataException
AlgernonDataException
protected void validateMacroArgumentTypes(Clause form, AlgernonKBSet kbSet, Map argumentTypes, AlgernonCompilerState compileState, ErrorSet compileErrors) throws AlgernonDataException
AlgernonDataException
protected Set lookupArgumentType(LispValue argument, Map argumentTypes)
argument
- argumentTypes
-
protected boolean typeEQ(AlgernonKBSet kbSet, LispValue argument, Set type, Map argumentTypes, Clause form, AlgernonCompilerState compileState, ErrorSet compileErrors) throws AlgernonDataException
type
- a Set of types for the argument.argumentTypes
- a map of argument types for all vars in the form.
AlgernonDataException
public boolean isFrameType(Set variableType)
public boolean isSimpleType(LispValue type)
public boolean isSimpleType(Set types)
public boolean isOfSimpleType(LispValue arg, Set type)
public boolean typesIntersect(AlgernonKBSet kbSet, Set types1, Set types2) throws AlgernonDataException
AlgernonDataException
public boolean typeSubsumedBy(AlgernonKBSet kbSet, LispValue singleType, Set types) throws AlgernonDataException
AlgernonDataException
protected boolean constantTypeEQ(AlgernonKBSet kbSet, LispValue argument, Set type, Clause form, AlgernonCompilerState compileState, ErrorSet compileErrors) throws AlgernonDataException
type
- may be either a list or a single symbol.
AlgernonDataException
protected void implicitTypeRestrict(AlgernonKBSet kbSet, Clause clause, Map argumentTypes, AlgernonCompilerState compileState, ErrorSet compileErrors)
public String undefinedRelationError(Clause clause, LispValue slot)
public String relationLengthMismatchError(int type, Clause clause, LispValue slot)
public String undeterminedDomainWarning(Clause clause, LispValue argument, Set type)
public String domainMismatchWarning(Clause clause, LispValue argument, Set variableType, Set desiredType)
public String unrecognizedOperatorError(Clause clause, LispValue slot)
public String pathRestrictionWarning(Clause clause, Rule rule)
public String deprecationWarning(LispValue oldOperator, String message, LispValue clause)
protected Path preprocessTaxonomy(AlgernonKBSet kbSet, LispValue form) throws AlgernonDataException
AlgernonDataException
protected LispValue doTaxonomyPreprocess(LispValue superclass, LispValue forms, BindingList bindings)
superclass
- the superclass of the formsforms
- the forms to be processedbindings
- Bindings from previous forms.
makeTaxonomyCommands(org.algernon.kb.AlgernonKBSet, org.jatha.dynatype.LispValue, org.algernon.datatype.BindingList)
protected Path makeTaxonomyCommands(AlgernonKBSet kbSet, LispValue pseudoTax, BindingList bindings) throws AlgernonDataException
AlgernonDataException
public Collection compileRule(Rule rule, AlgernonKBSet kbSet, BindingList bindings, Map argTypes, AlgernonCompilerState compileState, int startIndex, ErrorSet errors)
rule
- kbSet
- bindings
- compileState
- startIndex
- errors
-
protected String generateRuleName(Rule rule, BindingList variableSet)
protected Collection generateVariableSets(Clause clause) throws AlgernonDataException
AlgernonDataException
Collection
,
BindingList
public void initializeArgumentTypes(AlgernonKBSet kbSet, Map typeList, Path path, AlgernonCompilerState compileState, ErrorSet errors, boolean clear) throws AlgernonDataException
AlgernonDataException
public LispValue generateRuleCode(Rule rule, AlgernonKBSet kbSet, int direction, Path antecedent, Path consequent, int index, Rule rootRule, BindingList boundVariables, Map argumentTypes, ErrorSet errors)
private boolean hasInvalidArgumentCount(LispValue command, int numberOfArguments, int requiredNumber)
ZERO_OR_MORE means 0 or more. -1 means 1 or more, -2 means 2 or more, etc.
private void trace(String message)
public void setDebug(boolean state)
state
-
|
Algernon Software | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |