7 projects tagged "Python Modules"
PyBison is a sophisticated yet easy-to-use parser creation toolkit for Python that interfaces directly to Bison (yacc)-based parsers. It provides full LALR(1) grammar support, allowing for simple parsing tasks through to writing compilers for high-level languages. Parser code is automatically generated from rules within user-created Parser classes (written in Python), and then, compiled, yacc'ed and linked into a shared library, which is loaded into the running process. All this happens automatically. When the parser runs, it connects directly with the yyparse() routine, and takes event callbacks upon parse targets being reached.
LEPL is a recursive descent parser library written in Python. It is based on parser combinator libraries popular in functional programming, but also exploits Python language features. Operators provide a friendly syntax, and the consistent use of generators supports full backtracking and resource management. Backtracking implies that a wide variety of grammars are supported; appropriate memoisation ensures that even left-recursive grammars terminate.
Yappy provides a lexical analyser and a LR parser generator for Python applications. Currently it builds SLR, LR(1), and LALR(1) parsing tables. Tables are kept in Python shelves for use in parsing. Some ambiguous grammars can be handled if priority and associativity information is provided.