schrodinger.application.desmond.antlr3.dfa module

ANTLR3 runtime package

class schrodinger.application.desmond.antlr3.dfa.DFA(recognizer, decisionNumber, eot, eof, min, max, accept, special, transition)

Bases: object

@brief A DFA implemented as a set of transition tables.

Any state that has a semantic predicate edge is special; those states are generated with if-then-else structures in a specialStateTransition() which is generated by cyclicDFA template.

__init__(recognizer, decisionNumber, eot, eof, min, max, accept, special, transition)

Initialize self. See help(type(self)) for accurate signature.

predict(input)

From the input stream, predict what alternative will succeed using this DFA (representing the covering regular approximation to the underlying CFL). Return an alternative number 1..n. Throw

an exception upon error.
noViableAlt(s, input)
error(nvae)

A hook for debugging interface

specialStateTransition(s, input)
getDescription()
__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.application.desmond.antlr3.dfa', '__doc__': '@brief A DFA implemented as a set of transition tables.\n\n Any state that has a semantic predicate edge is special; those states\n are generated with if-then-else structures in a specialStateTransition()\n which is generated by cyclicDFA template.\n\n ', '__init__': <function DFA.__init__>, 'predict': <function DFA.predict>, 'noViableAlt': <function DFA.noViableAlt>, 'error': <function DFA.error>, 'specialStateTransition': <function DFA.specialStateTransition>, 'getDescription': <function DFA.getDescription>, 'unpack': <classmethod object>, '__dict__': <attribute '__dict__' of 'DFA' objects>, '__weakref__': <attribute '__weakref__' of 'DFA' objects>})
__dir__() → list

default dir() implementation

__eq__

Return self==value.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.application.desmond.antlr3.dfa'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

classmethod unpack(string)

@brief Unpack the runlength encoded table data.

Terence implemented packed table initializers, because Java has a size restriction on .class files and the lookup tables can grow pretty large. The generated JavaLexer.java of the Java.g example would be about 15MB with uncompressed array initializers.

Python does not have any size restrictions, but the compilation of such large source files seems to be pretty memory hungry. The memory consumption of the python process grew to >1.5GB when importing a 15MB lexer, eating all my swap space and I was to impacient to see, if it could finish at all. With packed initializers that are unpacked at import time of the lexer module, everything works like a charm.