Skip to content

Permit both versions 3.4 and 3.11 of ply - #455

Open
mandolaerik wants to merge 3 commits into
intel:mainfrom
mandolaerik:pr/permit-both-versions-3-4-and-3-11-of-ply
Open

Permit both versions 3.4 and 3.11 of ply#455
mandolaerik wants to merge 3 commits into
intel:mainfrom
mandolaerik:pr/permit-both-versions-3-4-and-3-11-of-ply

Conversation

@mandolaerik

Copy link
Copy Markdown
Contributor
  • Rip out vestigial grammar rules
  • Demand Ply 3.11 -- SIMICS-23703
  • Permit both versions 3.4 and 3.11 of ply

These are unreachable with how ply 3.4 handles shift/reduce conflicts
@syssimics

Copy link
Copy Markdown
Contributor

PR Verification: ❌ failure

@mandolaerik
mandolaerik force-pushed the pr/permit-both-versions-3-4-and-3-11-of-ply branch from 7ef495d to 83cc05a Compare September 7, 2026 20:44
@syssimics

Copy link
Copy Markdown
Contributor

PR Verification: ✅ success

Comment thread py/dml/toplevel.py
Comment on lines +57 to +71
tabmodule = "_dml%s_parsetab" % (''.join(map(str, version)))
tabfile = tabmodule + '.py'
if not os.path.isfile(tabfile):
# crude good-enough caching:
import tempfile
with tempfile.TemporaryDirectory(dir='.') as d:
parser = yacc.yacc(
module = dml.dmlparse.grammars[version],
tabmodule=tabmodule,
debug=False,
optimize=0,
outputdir=d)
import shutil
shutil.move(os.path.join(d, tabfile), tabfile)
sys.path.append('.')

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea here is to write something horrible that is good enough to not cause any trouble until the definitive 3.11 bump. E.g., the move can probably cause a race on Windows, and in theory it is not sound to assume . is writable. But we will get away with it.

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

Successfully merging this pull request may close these issues.

3 participants