Skip to content
This repository was archived by the owner on Dec 21, 2025. It is now read-only.

Commit 1fac9fe

Browse files
committed
Massive refactoring/cleanup
1 parent 1321375 commit 1fac9fe

70 files changed

Lines changed: 4263 additions & 8763 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGES

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,42 @@ IMPORTANT NOTE (2018-12-22): PLY is no longer be released in any
44
package-installable format. If you want to use the latest version, you
55
need to COPY the contents of the ply/ directory into your own project
66
and use it. Although PLY is no longer distributed as a package, it is
7-
maintained as a mature library. No new features are planned, but
8-
issues and pull requests for bugs are still welcome. Any changes to the
7+
maintained as a mature library. No new major features are planned, but
8+
issues reported for bugs are still welcome. Any changes to the
99
software will be noted here.
1010

11+
Version 4.0 (In progress)
12+
-------------------------
13+
Note: The 4.0 series of PLY represents a massive cleanup and modernization
14+
effort. At a fundamental level, no new "features" are being added.
15+
Instead, a lot of outdated, inconsistent, and problematic features are
16+
being eliminated. Here is a short summary:
17+
18+
- PLY no longer writes table files or cached data. If you want this,
19+
it's your responsibility to serialize the parser tables. Use pickle.
20+
21+
- Elimination of side-effects and global variables (generally).
22+
23+
- Elimination of numerous optional features in an effort to
24+
simplify the API.
25+
26+
- More use of modern Python features including iterators/generators,
27+
keyword-only arguments, f-strings, etc.
28+
29+
- Dropped support for Python 2.x
30+
------------------------
31+
32+
01/26/20 PLY no longer writes cached table files. Honestly, the use of
33+
the cached files made more sense when I was developing PLY on
34+
my 200Mhz PC in 2001. It's not as much as an issue now. For small
35+
to medium sized grammars, PLY should be almost instantaneous.
36+
If you're working with a large grammar, you can arrange
37+
to pickle the associated grammar instance yourself if need be.
38+
The removal of table files eliminated a large number of optional
39+
arguments to yacc() concerning the names and packages of these files.
40+
41+
01/26/20 PLY no longer supports Python 2.x.
42+
1143
01/01/20 Added an install.py script to make it easy to install PLY into
1244
virtual environment if you just want to play with it.
1345

CONTRIBUTING.md

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,5 @@ Contributing to PLY
33

44
PLY is a mature project. However, if you feel that you have found a
55
bug in PLY or its documentation, please submit an issue in the form
6-
of a bug report.
7-
8-
Important note: The Github repo for PLY always contains the most
9-
up-to-date version of the software. If you want to use the current
10-
version, you should COPY the contents of the `ply/` directory into
11-
your own project and use it. PLY is free software for you to use,
12-
but it is not maintained as a package that you install using pip
13-
or similar tools.
14-
15-
16-
17-
18-
19-
20-
21-
6+
of a bug report at https://github.com/dabeaz/ply. Pull requests
7+
to the project are not accepted.

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ virtual environment.
9393

9494
PLY has no third-party dependencies.
9595

96-
The file doc/ply.html contains complete documentation on how to use
96+
The docs/ directory contains complete documentation on how to use
9797
the system.
9898

9999
The example directory contains several different examples including a
@@ -176,7 +176,7 @@ def t_newline(t):
176176
t.lexer.lineno += t.value.count("\n")
177177

178178
def t_error(t):
179-
print("Illegal character '%s'" % t.value[0])
179+
print(f"Illegal character {t.value[0]!r}")
180180
t.lexer.skip(1)
181181

182182
# Build the lexer
@@ -228,18 +228,18 @@ def p_expression_name(p):
228228
try:
229229
p[0] = names[p[1]]
230230
except LookupError:
231-
print("Undefined name '%s'" % p[1])
231+
print(f"Undefined name {p[1]!r}")
232232
p[0] = 0
233233

234234
def p_error(p):
235-
print("Syntax error at '%s'" % p.value)
235+
print(f"Syntax error at {p.value!r}")
236236

237237
import ply.yacc as yacc
238238
yacc.yacc()
239239

240240
while True:
241241
try:
242-
s = raw_input('calc > ') # use input() on Python 3
242+
s = input('calc > ')
243243
except EOFError:
244244
break
245245
yacc.parse(s)

0 commit comments

Comments
 (0)