wugle.expression.logic
Class PropositionalLogicTreeWalker

java.lang.Object
  |
  +--antlr.TreeParser
        |
        +--wugle.expression.logic.PropositionalLogicTreeWalker
All Implemented Interfaces:
PropositionalLogicLexerTokenTypes

public class PropositionalLogicTreeWalker
extends antlr.TreeParser
implements PropositionalLogicLexerTokenTypes

Evaluates a propositional logic tree. A PropositionalLogicTreeWalker evaluates a tree conforming to the given propositional logic grammar.

Version:
0.1.4
Author:
Franz Prilmeier

Field Summary
static java.lang.String[] _tokenNames
           
 
Fields inherited from class antlr.TreeParser
_retTree, astFactory, ASTNULL, inputState, returnAST, tokenNames, traceDepth
 
Fields inherited from interface wugle.expression.logic.PropositionalLogicLexerTokenTypes
AND, EOF, FALSE, IFF, IMPLIES, LITERAL, LITERAL_LETTER, LPAREN, NOT, NULL_TREE_LOOKAHEAD, OR, RPAREN, TRUE, WHITESPACE, XOR
 
Constructor Summary
PropositionalLogicTreeWalker()
           
 
Method Summary
 Expression expression(antlr.collections.AST _t)
          Evaluates expression rules.
static void main(java.lang.String[] args)
          Reads a sentence in propositional logic from a file.
 
Methods inherited from class antlr.TreeParser
getAST, getASTFactory, getTokenName, getTokenNames, match, match, matchNot, panic, reportError, reportError, reportWarning, setASTFactory, setASTNodeClass, setASTNodeType, traceIn, traceIndent, traceOut
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_tokenNames

public static final java.lang.String[] _tokenNames
Constructor Detail

PropositionalLogicTreeWalker

public PropositionalLogicTreeWalker()
Method Detail

main

public static void main(java.lang.String[] args)
                 throws antlr.RecognitionException,
                        java.io.FileNotFoundException,
                        antlr.TokenStreamException
Reads a sentence in propositional logic from a file. This method is for nothing else than demonstrating purposes. To be specific it shows how to

Parameters:
args - the command parameters. There is only one at the moment, args[ 0 ] which defines the input file name.
Throws:
antlr.RecognitionException - occurs when an input sentence is not parseable, i.e. not conforming to the given grammar.
java.io.FileNotFoundException - if the file name of the input file refers to an unknown resource.
antlr.TokenStreamException - if the input file cannot be tokenized according to the given grammar. This could be an illegal or unexpected character, for example.

expression

public final Expression expression(antlr.collections.AST _t)
                            throws antlr.RecognitionException
Evaluates expression rules. Evaluates the expression rule which is considered as the starting symbol of the grammar. To be specific this method converts the token stream / parse tree into the internal Expression data structure of WUGLE.

Returns:
the read expression. Returns a null pointer if the parse tree is empty.
antlr.RecognitionException