Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * Copyright The Sett Ltd, 2005 to 2014.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
  *     http://www.apache.org/licenses/LICENSE-2.0
  *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.thesett.aima.logic.fol.wam.builtins;
BuiltIn defines the behaviour of Prolog built-in predicates.

CRC Card
Responsibilities
Generate instructions to set up the arguments to a call to a built-in functor.
Generate instructions to call to a built-in functor.

Author(s):
Rupert Smith
public interface BuiltIn
{
    
Compiles the arguments to a call to a body of a clause into an instruction listing in WAM.

The name of the clause containing the body, and the position of the body within this clause are passed as arguments, mainly so that these coordinates can be used to help make any labels generated within the generated code unique.

Parameters:
expression The clause body to compile.
isFirstBody true iff this is the first body of a program clause.
clauseName The name of the clause within which this body appears.
bodyNumber The body position within the containing clause.
Returns:
A listing of the instructions for the clause body in the WAM instruction set.
    SizeableLinkedList<WAMInstructioncompileBodyArguments(Functor expressionboolean isFirstBody,
        FunctorName clauseNameint bodyNumber);

    
Compiles a call to a body of a clause into an instruction listing in WAM.

Parameters:
expression The body functor to call.
isFirstBody Iff this is the first body in a clause.
isLastBody Iff this is the last body in a clause.
chainRule Iff the clause is a chain rule, so has no environment frame.
permVarsRemaining The number of permanent variables remaining at this point in the calling clause. Used for environment trimming.
Returns:
A list of instructions for the body call.
    SizeableLinkedList<WAMInstructioncompileBodyCall(Functor expressionboolean isFirstBodyboolean isLastBody,
        boolean chainRuleint permVarsRemaining);
New to GrepCode? Check out our FAQ X