HOME

TheInfoList



OR:

PLY is a
parsing Parsing, syntax analysis, or syntactic analysis is the process of analyzing a string of symbols, either in natural language, computer languages or data structures, conforming to the rules of a formal grammar. The term ''parsing'' comes from Lati ...
tool written purely in Python. It is, in essence, a re-implementation of Lex and
Yacc Yacc (Yet Another Compiler-Compiler) is a computer program for the Unix operating system developed by Stephen C. Johnson. It is a Look Ahead Left-to-Right Rightmost Derivation (LALR) parser generator, generating a LALR parser (the part of a comp ...
originally in C-language. It was written by David M. Beazley. PLY uses the same LALR parsing technique as Lex and Yacc. It also has extensive
debugging In computer programming and software development, debugging is the process of finding and resolving ''bugs'' (defects or problems that prevent correct operation) within computer programs, software, or systems. Debugging tactics can involve in ...
and error reporting facilities.


Features

Implemented in Python, it has almost all the features provided by Lex and Yacc. It includes support for empty productions, precedence rules, error recovery, and
ambiguous grammar In computer science, an ambiguous grammar is a context-free grammar for which there exists a string that can have more than one leftmost derivation or parse tree, while an unambiguous grammar is a context-free grammar for which every valid string ...
s. It supports Python 3.


Structure of a PLY file

PLY has the following two Python modules which are part of the ply package. *ply.lex - A re-implementation of Lex for lexical analysis *ply.yacc - A re-implementation of
Yacc Yacc (Yet Another Compiler-Compiler) is a computer program for the Unix operating system developed by Stephen C. Johnson. It is a Look Ahead Left-to-Right Rightmost Derivation (LALR) parser generator, generating a LALR parser (the part of a comp ...
for parser creation


References

{{Authority control Parser generators Python (programming language) software Lexical analysis