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.compiler;
WAMCompiler implements the com.thesett.aima.logic.fol.LogicCompiler interface for the complete WAM compilation chain. It is a supervising compiler, that chains together the work of the compiler pipe-line stages.

CRC Card
Responsibilities Collaborations
Chain together the compiler pipe-line stages.

Author(s):
Rupert Smith
{
    
Holds the pre-compiler, for analyzing and transforming terms prior to compilation proper.
    PreCompiler preCompiler;

    
Holds the instruction generating compiler.
Creates a new WAMCompiler.

Parameters:
symbolTable The symbol table.
interner The machine to translate functor and variable names.
    public WAMCompiler(SymbolTable<IntegerStringObjectsymbolTableVariableAndFunctorInterner interner)
    {
        super(symbolTableinterner);
         = new InstructionCompiler(symbolTableinterner);
         = new PreCompiler(symbolTableinterner);
    }

    
    public void compile(Sentence<Clausesentencethrows SourceCodeException
    {
        .compile(sentence);
    }

    
    {
        .setCompilerObserver(observer);
    }

    
    public void endScope() throws SourceCodeException
    {
        .endScope();
        .endScope();
    }

    
Chains compilation completion events onto the instruction compiler.
    {
        
        public void onCompilation(Sentence<Clausesentencethrows SourceCodeException
        {
            .compile(sentence);
        }

        
        public void onQueryCompilation(Sentence<Clausesentencethrows SourceCodeException
        {
            .compile(sentence);
        }
    }
New to GrepCode? Check out our FAQ X