__init__.py |
A parser generator ____ enough to cope with JavaScript. |
62 |
actions.py |
StackDiff represent stack mutations which have to be performed when executing an action.
|
23124 |
aps.py |
Compute all paths which might be reduced by a given action. This function
assumes that the state is reachable from the starting goals, and that
the depth which is being queried has valid answers. |
19324 |
emit |
|
|
extension.py |
Data structure extracted from parsing the EDSL which are added within the
Rust code. |
3743 |
gen.py |
gen.py - Fifth stab at a parser generator.
**Grammars.**
A grammar is a dictionary {str: [[symbol]]} mapping names of nonterminals to
lists of right-hand sides. Each right-hand side is a list of symbols. There
are several kinds of symbols; see grammar.py to learn more.
Instead of a list of right-hand sides, the value of a grammar entry may be a
function; see grammar.Nt for details.
**Token streams.**
The user passes to each method an object representing the input sequence.
This object must support two methods:
* `src.peek()` returns the kind of the next token, or `None` at the end of
input.
* `src.take(kind)` throws an exception if `src.peek() != kind`;
otherwise, it removes the next token from the input stream and returns it.
The special case `src.take(None)` checks that the input stream is empty:
if so, it returns None; if not, it throws.
For very basic needs, see `lexer.LexicalGrammar`.
|
3844 |
grammar.py |
Data structures for representing grammars. |
50292 |
lexer.py |
Lexical analysis is the breaking of a string into tokens. |
7834 |
lr0.py |
Generate a simple LR0 state graph from a CanonicalGrammar.
The resulting graph may contain inconsistent states, which must be resolved by the
ParseTable before a parser can be generated.
|
15324 |
main.py |
jsparagus/main.py - Generate a parser from a pgen grammar.
(This is for testing. pgen will likely go away. Ignore this for now.)
|
844 |
ordered.py |
Deterministic data structures. |
4794 |
parse_pgen.py |
parse_pgen.py - Parse grammars written in the pgen parser specification language.
I'm not sure I want to keep this pgen mini-language around; ignore this for now.
|
8127 |
parse_pgen_generated.py |
|
36586 |
parse_table.py |
This is one state of the parse table, which has transitions based on
terminals (text), non-terminals (grammar rules) and epsilon (reduce).
In this model epsilon transitions are used to represent code to be executed
such as reduce actions and any others actions.
|
81724 |
README.md |
# jsparagus parser generator |
3159 |
rewrites.py |
Early-pipeline operations that error-check and lower grammars. |
29753 |
runtime.py |
Runtime support for jsparagus-generated parsers. |
11239 |
types.py |
Type inference for reduce expressions.
The nonterminals and reduce expressions in a grammar can have types, to support
generating parsers in typeful languages. Types are represented by `Type` objects.
A `TypeVar` is a type variable that might be bound to any type. This is used
only during inference. So during inference, a type is either a `Type` or a
`TypeVar`
In addition, MethodType simply gathers together a return type and a list of
argument types.
See infer_types() for more.
|
11329 |
utils.py |
List of functions which are useful in many places. |
2036 |