Skip to content

Commit

Permalink
Massive refactoring/cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
dabeaz committed Feb 22, 2020
1 parent 1321375 commit 1fac9fe
Show file tree
Hide file tree
Showing 70 changed files with 4,263 additions and 8,763 deletions.
36 changes: 34 additions & 2 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,42 @@ IMPORTANT NOTE (2018-12-22): PLY is no longer be released in any
package-installable format. If you want to use the latest version, you
need to COPY the contents of the ply/ directory into your own project
and use it. Although PLY is no longer distributed as a package, it is
maintained as a mature library. No new features are planned, but
issues and pull requests for bugs are still welcome. Any changes to the
maintained as a mature library. No new major features are planned, but
issues reported for bugs are still welcome. Any changes to the
software will be noted here.

Version 4.0 (In progress)
-------------------------
Note: The 4.0 series of PLY represents a massive cleanup and modernization
effort. At a fundamental level, no new "features" are being added.
Instead, a lot of outdated, inconsistent, and problematic features are
being eliminated. Here is a short summary:

- PLY no longer writes table files or cached data. If you want this,
it's your responsibility to serialize the parser tables. Use pickle.

- Elimination of side-effects and global variables (generally).

- Elimination of numerous optional features in an effort to
simplify the API.

- More use of modern Python features including iterators/generators,
keyword-only arguments, f-strings, etc.

- Dropped support for Python 2.x
------------------------

01/26/20 PLY no longer writes cached table files. Honestly, the use of
the cached files made more sense when I was developing PLY on
my 200Mhz PC in 2001. It's not as much as an issue now. For small
to medium sized grammars, PLY should be almost instantaneous.
If you're working with a large grammar, you can arrange
to pickle the associated grammar instance yourself if need be.
The removal of table files eliminated a large number of optional
arguments to yacc() concerning the names and packages of these files.

01/26/20 PLY no longer supports Python 2.x.

01/01/20 Added an install.py script to make it easy to install PLY into
virtual environment if you just want to play with it.

Expand Down
18 changes: 2 additions & 16 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,5 @@ Contributing to PLY

PLY is a mature project. However, if you feel that you have found a
bug in PLY or its documentation, please submit an issue in the form
of a bug report.

Important note: The Github repo for PLY always contains the most
up-to-date version of the software. If you want to use the current
version, you should COPY the contents of the `ply/` directory into
your own project and use it. PLY is free software for you to use,
but it is not maintained as a package that you install using pip
or similar tools.








of a bug report at https://github.com/dabeaz/ply. Pull requests
to the project are not accepted.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ virtual environment.

PLY has no third-party dependencies.

The file doc/ply.html contains complete documentation on how to use
The docs/ directory contains complete documentation on how to use
the system.

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

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

# Build the lexer
Expand Down Expand Up @@ -228,18 +228,18 @@ def p_expression_name(p):
try:
p[0] = names[p[1]]
except LookupError:
print("Undefined name '%s'" % p[1])
print(f"Undefined name {p[1]!r}")
p[0] = 0

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

import ply.yacc as yacc
yacc.yacc()

while True:
try:
s = raw_input('calc > ') # use input() on Python 3
s = input('calc > ')
except EOFError:
break
yacc.parse(s)
Expand Down
Loading

0 comments on commit 1fac9fe

Please sign in to comment.