Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yacc argument "write_tables" is missing in 3.11 #277

Closed
paudano opened this issue Dec 6, 2022 · 5 comments
Closed

yacc argument "write_tables" is missing in 3.11 #277

paudano opened this issue Dec 6, 2022 · 5 comments

Comments

@paudano
Copy link

paudano commented Dec 6, 2022

The write_tables argument to yacc.yacc() is missing in 3.11. Documentation on https://www.dabeaz.com/ply/ply.html for 3.11 still has this option in it. Was it removed? If I move to 3.11, can I prevent yacc from writing parsetable.py? I have a very small grammar I use this for.

@dabeaz
Copy link
Owner

dabeaz commented Dec 7, 2022

The feature of writing tables was removed entirely at some point. However, I think this was post-3.11 and would only be present in code copied from GitHub.

@paudano
Copy link
Author

paudano commented Dec 27, 2022

Thanks!

@paudano paudano closed this as completed Dec 27, 2022
@nxmaintainer
Copy link

The feature of writing tables was removed entirely at some point. However, I think this was post-3.11 and would only be present in code copied from GitHub.

Excuse me for opening the issue again, I've noticed Massive refactoring/cleanup commit removes optimized mode and all related stuff, including cached tables. Can you elaborate in a few words the rationale, please? Is there any potential performance degradation related to it? I've seen these tables in pycparser (it still uses ply 3.10), for example

@dabeaz
Copy link
Owner

dabeaz commented Apr 27, 2023

PLY was originally written on a 200 Mhz PC and the initial implementation was quite slow at table generation (a large grammar could take tens of seconds). Machines have become much faster and PLY uses a significantly better algorithm than it did before. On my current desktop machine, generating tables for the full ANSI C grammar barely takes 0.1 second.

Writing of cache files was always problematic for various reasons--especially for deployment and packaging. Most people do not expect a third-party package to be implicitly writing temporary files as a side-effect of usage. Frankly, it was a never-ending source of bug reports and I'm glad to be rid of it.

If you want the parsing tables to be cached, the parser should be serializable with pickle. Use that to write it out and bring it back in your application. Alternatively, if startup time matters a lot, you might consider writing a daemonized parser instead.

@nxmaintainer
Copy link

If you want the parsing tables to be cached, the parser should be serializable with pickle. Use that to write it out and bring it back in your application. Alternatively, if startup time matters a lot, you might consider writing a daemonized parser instead.

Thank you for your time, sir. Totally makes sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants