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.interpreter;
PrologInterpreter builds an interactive resolving interpreter using the interpreted resolution engine com.thesett.aima.logic.fol.wam.nativemachine.WAMResolvingNativeMachine.

CRC Card
Responsibilities Collaborations
Create an interpreter for WAM. com.thesett.aima.logic.fol.isoprologparser.SentenceParser, com.thesett.aima.logic.fol.wam.compiler.InstructionCompiler, com.thesett.aima.logic.fol.wam.nativemachine.WAMResolvingNativeMachine

Author(s):
Rupert Smith
public class WAMNativeInterpreter
{
    
Used for debugging purposes.
    /* private static final Logger log = Logger.getLogger(WAMNativeInterpreter.class.getName()); */

    
Creates the interpreter and launches its top-level run loop.

Parameters:
args The command line arguments.
    public static void main(String[] args)
    {
        try
        {
            SymbolTableImpl<IntegerStringObjectsymbolTable = new SymbolTableImpl<IntegerStringObject>();
            final WAMResolvingMachine machine = new WAMResolvingNativeMachine(symbolTable);
            Parser<ClauseTokenparser = new SentenceParser(machine);
            parser.setTokenSource(TokenSource.getTokenSourceForInputStream(.));
            LogicCompiler<ClauseWAMCompiledPredicateWAMCompiledQuerycompiler =
                new WAMCompiler(symbolTablemachine);
            ResolutionEngine<ClauseWAMCompiledPredicateWAMCompiledQueryengine =
                new WAMEngine(parsermachinecompilermachine);
            engine.reset();
            ResolutionInterpreter<WAMCompiledPredicateWAMCompiledQueryinterpreter =
                new ResolutionInterpreter<WAMCompiledPredicateWAMCompiledQuery>(engine);
            interpreter.interpreterLoop();
        }
        catch (Exception e)
        {
            /*log.log(java.util.logging.Level.SEVERE, e.getMessage(), e);*/
            e.printStackTrace(new PrintStream(.));
            System.exit(-1);
        }
    }
New to GrepCode? Check out our FAQ X