
com.thesett.aima.logic.fol.wam.compiler.WAMCompiledPredicate Maven / Gradle / Ivy
/*
* 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.compiler;
import java.nio.ByteBuffer;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.thesett.aima.attribute.impl.IdAttribute;
import com.thesett.aima.logic.fol.Clause;
import com.thesett.aima.logic.fol.FunctorName;
import com.thesett.aima.logic.fol.LinkageException;
import com.thesett.aima.logic.fol.Predicate;
import com.thesett.aima.logic.fol.Sentence;
import com.thesett.aima.logic.fol.wam.machine.WAMMachine;
import com.thesett.common.util.Sizeable;
import com.thesett.common.util.SizeableLinkedList;
import com.thesett.common.util.SizeableList;
/**
* A compiled term is a handle onto a compiled down to binary code term. Compiled terms are not Java code and may be
* executed outside of the JVM, but the Java retains a handle on them and provides sufficient wrapping around them that
* they can be made to look as if they are a transparent abstract syntax tree within the JVM. This requires an ability
* to decompile a clause back into its abstract syntax tree.
*
* Decompilation of functors requires access to a mapping from registers to variables, but the variable to register
* assignment is created at compile time accross a whole clause. Each functor that forms part of the clause head or body
* must therefore hold a link to its containing functor in order to access this mapping.
*
*
CRC Card
* Responsibilities
* Decompile/decode a binary term to restore its abstract syntax tree.
*
*
* @author Rupert Smith
* @todo For each functor in the head and body, set this as the containing clause. A mapping from variables to
* registers is maintained in the clause, and the functors need to be able to access this mapping.
*/
public class WAMCompiledPredicate extends Predicate© 2015 - 2025 Weber Informatics LLC | Privacy Policy