| |
- __builtin__.object
-
- jupyLR.tokenizer.Scanner
- jupyLR.parser.parser(__builtin__.object)
-
- jupyLR.automaton.Automaton
class Automaton(jupyLR.parser.parser) |
|
A GLR parser. |
|
- Method resolution order:
- Automaton
- jupyLR.parser.parser
- __builtin__.object
Methods defined here:
- __call__(self, text)
- Parse this text and return a list of valid ASTs, if any. On error,
returns None.
- __init__(self, start_sym, grammar, scanner)
- Construct a GLR automaton given an LR grammar and a start symbol.
The scanner that creates the automaton input is also provided for
convenience of use.
- error_detected(self, cur_tok, last_states)
- Overload this method in subclasses to implement error recovery
or notification.
- validate_ast(self, ast)
- Overload this method in subclasses to discriminate semantically
invalid ASTs on the fly.
Return None for an invalid AST, or whatever you want to end up in the
resulting AST.
Methods inherited from jupyLR.parser.parser:
- __str__(self)
- action_to_str(self)
- Stringify the ACTION/GOTO table for pretty-print.
- closure(self, s)
- Compute the closure of an item set.
- compute_ACTION(self)
- Compute the ACTION/GOTO table.
- compute_GOTO(self)
- Compute the GOTO table.
- compute_lr0(self)
- Compute the LR(0) sets.
- conflicts(self)
- Returns the list of conflicts in the ACTION table.
- count_conflicts(self)
- Returns the count of conflicts in the ACTION table.
- dump_sets(self)
- Pretty-print all LR(0) item sets.
- following_tokens(self, item)
- Returns all tokens following the current item.
- index(self, s)
- Returns the index of (the closure of) item set s in the LR(0) sets
list.
- init_row(self, init=None)
- Initialize a row of the ACTION table.
- itemset(self, i)
- itemsetstr(self, item, label='')
- Stringify an item set for pretty-print.
- itemstr(self, item)
- Stringify an item for pretty-print.
- kernel(self, s)
- Compute the kernel of an item set.
- next_items(self, item, visited=None)
- Compute the yet unvisited items following the given item.
Data descriptors inherited from jupyLR.parser.parser:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- unused_rules
|
class Scanner(__builtin__.object) |
| |
Methods defined here:
- __call__(self, text)
- Iteratively scans through text and yield each token
- __init__(self, **tokens)
- add(self, **tokens)
- Each named keyword is a token type and its value is the
corresponding regular expression. Returns a function that iterates
tokens in the form (type, value) over a string.
Special keywords are discard_names and discard_values, which specify
lists (actually any iterable is accepted) containing tokens names or
values that must be discarded from the scanner output.
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
| |