Package nltk_lite :: Package contrib :: Package mit :: Package six863 :: Package semantics :: Module logic :: Class Parser
[hide private]
[frames] | no frames]

Class Parser

source code

A lambda calculus expression parser.

Instance Methods [hide private]
 
__init__(self, data=None, constants=None) source code
 
feed(self, data)
Feed another batch of data to the parser.
source code
 
parse(self, data)
Provides a method similar to other NLTK parsers.
source code
 
process(self)
Process the waiting stream to make it trivial to parse.
source code
 
token(self, destructive=1)
Get the next waiting token.
source code
 
isVariable(self, token)
Is this token a variable (that is, not one of the other types)?
source code
 
next(self)
Parse the next complete expression from the stream and return it.
source code
 
make_ApplicationExpression(self, first, second) source code
 
make_LambdaExpression(self, first, second) source code
 
make_SomeExpression(self, first, second) source code
 
make_AllExpression(self, first, second) source code
Class Variables [hide private]
  LAMBDA = '\\'
  SOME = 'some'
  ALL = 'all'
  DOT = '.'
  OPEN = '('
  CLOSE = ')'
  BOOL = ['and', 'or', 'not', 'implies', 'iff', '=']
  EQ = '='
  OPS = ['and', 'or', 'not', 'implies', 'iff', '=']
Method Details [hide private]

parse(self, data)

source code 

Provides a method similar to other NLTK parsers.

Returns:
a parsed Expression

token(self, destructive=1)

source code 

Get the next waiting token. The destructive flag indicates whether the token will be removed from the buffer; setting it to 0 gives lookahead capability.