Jump to content

PLY (software): Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
BattyBot (talk | contribs)
Changing short description from "Parsing tool written purely in Python" to "Re-implementation of Lex and Yacc in Python"
 
(20 intermediate revisions by 15 users not shown)
Line 1: Line 1:
{{Short description|Re-implementation of Lex and Yacc in Python}}
{{refimprove|date=April 2014}}
{{Other uses|Ply (disambiguation)}}

{{More citations needed|date=April 2014}}
{{Infobox software
{{Infobox software
| name = PLY (Python Lex-Yacc)
| name = PLY (Python Lex-Yacc)
Line 7: Line 8:
| caption =
| caption =
| collapsible =
| collapsible =
| author = David Beazley
| author = [[David M. Beazley]]
| developer =
| developer =
| released =
| released =
| latest release version = 3.11
| discontinued =
| discontinued =
| frequently updated = yes
| programming language = [[Python (programming language)|Python]]
| programming language = [[Python (programming language)|Python]]
| operating system =
| operating system =
Line 17: Line 18:
| size =
| size =
| language =
| language =
| status =
| genre =
| genre =
| license =
| license =
| website = {{URL|http://www.dabeaz.com/ply/}}
| website = {{URL|dabeaz.com/ply/}}
}}
}}


'''PLY''' is a parsing tool written purely in [[Python (programming language)|Python]]. It is basically a re-implementation of [[Lex (software)|Lex]] and [[Yacc]] originally in [[C (programming language)|C-language]]. It was written by David Beazley.<ref>{{cite web |url=/proxy/http://www.dabeaz.com/ply/|title=PLY Homepage}}</ref> Unlike Lex and Yacc in C which uses [[LALR parser|LALR]] parsing technique, PLY uses [[LR parser|LR]] parsing which can incorporate large [[Context-free grammar|grammars]] easily. PLY also has extensive debugging and error reporting facilities.
'''PLY''' is a [[parsing]] tool written purely in [[Python (programming language)|Python]]. It is, in essence, a re-implementation of [[Lex (software)|Lex]] and [[Yacc]] originally in [[C (programming language)|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]] and error reporting facilities.<ref name=off>{{cite web |url=/proxy/http://www.dabeaz.com/ply/|title=PLY Homepage}}</ref>

==History==
David Beazley originally wrote PLY in 2001 for an introductory course on compilers. He created it to aid the students in creating compilers for simple Pascal-like languages.<ref>http://www.drdobbs.com/web-development/prototyping-interpreters-using-python-le/184405580</ref>
Since then it has seen many improvements and has come out as one of the popular parsing tools.


==Features==
==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 grammars.
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]]s. It supports Python 3.

PLY-3.0 includes support for Python 3.0 and some other features.


==Structure of a PLY file==
==Structure the PLY module==
PLY has the following two Python modules which are part of the ply package.<ref>{{cite web |url=/proxy/http://www.dabeaz.com/ply/ply.html#ply_nn2 |title=Official Documentation}}</ref>
PLY has the following two Python modules which are part of the ply package.<ref>{{cite web |url=/proxy/http://www.dabeaz.com/ply/ply.html#ply_nn2 |title=Official Documentation}}</ref>
*'''ply.lex''' - This deals with the lexical analysis part.
*'''ply.lex''' - A re-implementation of [[Lex (software)|Lex]] for lexical analysis
*'''ply.yacc''' - This module is for creating a parser.
*'''ply.yacc''' - A re-implementation of [[Yacc]] for parser creation
These files contain the necessary modules.


==References==
==References==
{{Reflist}}
{{Reflist}}
<!--- After listing your sources please cite them using inline citations and place them after the information they cite. Please see http://en.wikipedia.org/wiki/Wikipedia:REFB for instructions on how to add citations. --->
*
*
*
*


{{Authority control}}
<!--- STOP! Be warned that by using this process instead of Articles for Creation, this article is subject to scrutiny. As an article in "mainspace", it will be DELETED if there are problems, not just declined. If you wish to use AfC, please return to the Wizard and continue from there. --->


[[Category:Parser generators]]
[[Category:Parser generators]]
[[Category:Python software]]
[[Category:Python (programming language) software]]
[[Category:Lexical analysis]]

Latest revision as of 00:58, 18 October 2024

PLY (Python Lex-Yacc)
Original author(s)David M. Beazley
Stable release
3.11
Repository
Written inPython
Websitedabeaz.com/ply/

PLY is a parsing tool written purely in Python. It is, in essence, a re-implementation of Lex and Yacc 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 and error reporting facilities.[1]

Features

[edit]

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 grammars. It supports Python 3.

Structure the PLY module

[edit]

PLY has the following two Python modules which are part of the ply package.[2]

  • ply.lex - A re-implementation of Lex for lexical analysis
  • ply.yacc - A re-implementation of Yacc for parser creation

References

[edit]
  1. ^ "PLY Homepage".
  2. ^ "Official Documentation".