public class RuleClauseCode extends Object
Modifier and Type | Field and Description |
---|---|
static byte |
ALLOCATE
Allocate a new environment frame
|
static byte |
CALL_BUILTIN
call a built-in operation defined by a rule clause (clauseIndex(
|
static byte |
CALL_PREDICATE
call a predicate code object (predicateCodeList)
|
static byte |
CALL_PREDICATE_INDEX
call a predicate code object with run time indexing (predicateCodeList)
|
static byte |
CALL_TABLED
call a table code object ()
|
static byte |
CALL_TRIPLE_MATCH
call a pure triple match (predicate)
|
static byte |
CALL_WILD_TABLED
call a table code object from a wildcard ()
|
static byte |
CLEAR_ARG
reset an argument to an unbound variable (Ai)
|
static byte |
CLEAR_TEMP
reset a temp variable to an unbound variable (Ti)
|
static byte |
CLEAR_VARIABLE
reset a permanent variable to an unbound variable (Yi)
|
static byte |
GET_CONSTANT
fetch constant argument (const, Ai)
|
static byte |
GET_FUNCTOR
deconstruct a functor argument (functor)
|
static byte |
GET_TEMP
fetch temporary variable argument (Ti, Ai)
|
static byte |
GET_VARIABLE
fetch permanent variable argument, first occurance (Yi, Ai)
|
static byte |
LAST_CALL_PREDICATE
variant on CALL_PREDICATE using the last call optimization, only current used in chain rules
|
static byte |
MAKE_FUNCTOR
create a functor object from a rule template (templateFunctor)
|
static int |
MAX_ARGUMENT_VARS
The maximum number of argument variables allowed in a single goal
Future refactorings will remove this restriction.
|
static int |
MAX_PERMANENT_VARS
The maximum number of permanent variables allowed in a single rule clause.
|
static int |
MAX_TEMPORARY_VARS
The maximum number of temporary variables allowed in a single rule clause.
|
static byte |
PROCEED
return from a call, proceeed along AND tree
|
static byte |
PUT_CONSTANT
put constant value into call parameter (const, Ai)
|
static byte |
PUT_DEREF_VARIABLE
put a dereferenced permanent variable into call parameter ready for BUILTIN call (Yi, Ai)
|
static byte |
PUT_NEW_VARIABLE
put permanaent variable into call parameter, first occurance (Yi, Ai)
|
static byte |
PUT_TEMP
put temp variable into call parameter (Ti, Ai)
|
static byte |
PUT_VARIABLE
put permanaent variable into call parameter (Yi, Ai)
|
static RuleClauseCode |
returnCodeBlock
Dummy code block which just returns
|
static byte |
TEST_BOUND
Test if an argument is bound (Ai)
|
static byte |
TEST_UNBOUND
Test if an argument is unbound (Ai)
|
static byte |
UNIFY_TEMP
fetch temporary variable argument, later occurance (Ti, Ai)
|
static byte |
UNIFY_VARIABLE
fetch permanent variable argument, later occurance (Yi, Ai)
|
Constructor and Description |
---|
RuleClauseCode(Rule rule)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
compile(LPRuleStore ruleStore)
Compile the rule into byte code.
|
Object[] |
getArgs()
Return the argument vector associated with this clauses' byte codes.
|
byte[] |
getCode()
Return the byte code vector for this clause.
|
Rule |
getRule()
Return the rule from which this code block was compiled.
|
static void |
main(String[] args)
Debug support - not unit testing.
|
void |
print(PrintStream out)
Debug helper - list the code to a stream
|
int |
termIndex(int pc)
Translate a program counter offset to the index of the corresponding
body term (or -1 if a head term or a dummy rule).
|
String |
toString()
Print clause as rule for tracing.
|
public static final byte GET_CONSTANT
public static final byte GET_VARIABLE
public static final byte UNIFY_VARIABLE
public static final byte GET_TEMP
public static final byte UNIFY_TEMP
public static final byte PUT_CONSTANT
public static final byte PUT_NEW_VARIABLE
public static final byte PUT_VARIABLE
public static final byte PUT_DEREF_VARIABLE
public static final byte PUT_TEMP
public static final byte CALL_PREDICATE
public static final byte GET_FUNCTOR
public static final byte CALL_PREDICATE_INDEX
public static final byte CALL_TRIPLE_MATCH
public static final byte LAST_CALL_PREDICATE
public static final byte CALL_TABLED
public static final byte CALL_WILD_TABLED
public static final byte PROCEED
public static final byte MAKE_FUNCTOR
public static final byte CALL_BUILTIN
public static final byte CLEAR_VARIABLE
public static final byte CLEAR_TEMP
public static final byte CLEAR_ARG
public static final byte ALLOCATE
public static final byte TEST_BOUND
public static final byte TEST_UNBOUND
public static final int MAX_PERMANENT_VARS
public static final int MAX_ARGUMENT_VARS
public static final int MAX_TEMPORARY_VARS
public static RuleClauseCode returnCodeBlock
public RuleClauseCode(Rule rule)
rule
- the rule to be compiledpublic byte[] getCode()
public Object[] getArgs()
public Rule getRule()
public void compile(LPRuleStore ruleStore)
ruleStore
- the store of LP rules through which calls to other predicates
can be resolved.public int termIndex(int pc)
public void print(PrintStream out)
public String toString()
public static void main(String[] args)
Licenced under the Apache License, Version 2.0