
com.thesett.aima.logic.fol.wam.optimizer.WAMOptimizer 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.optimizer;
import java.util.List;
import com.thesett.aima.logic.fol.VariableAndFunctorInterner;
import com.thesett.aima.logic.fol.wam.compiler.WAMInstruction;
import com.thesett.aima.logic.fol.wam.compiler.WAMOptimizeableListing;
import com.thesett.common.util.SizeableLinkedList;
import com.thesett.common.util.SizeableList;
import com.thesett.common.util.doublemaps.SymbolTable;
/**
* WAMOptimizer performs peephole optimization on a list of WAM instructions.
*
*
CRC Card
* Responsibilities Collaborations
* Optimize a WAM instruction listing.
*
*
* @author Rupert Smith
*/
public class WAMOptimizer implements Optimizer
{
/** The symbol table. */
protected final SymbolTable* unify_var Xi, get_struc a/0, Xi -> unify_const a/0 * get_struc a/0, Xi -> get_const a/0 * put_struc a/0, Xi, set_var Xi -> set_const a/0 * put_struc a/0, Xi -> put_const a/0 ** * @param instructions The instructions to optimize. * * @return An list of optimized instructions. */ private SizeableList
© 2015 - 2025 Weber Informatics LLC | Privacy Policy