-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
GH-98831: "Generate" the interpreter #98830
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
Merged
Merged
Changes from 73 commits
Commits
Show all changes
89 commits
Select commit
Hold shift + click to select a range
089ab0c
New script to generate the ceval switch
gvanrossum bba5b94
Add 'End regular instructions' marker
gvanrossum 99b0058
Extract to a format closer to interpreter_definition.md
gvanrossum 2939830
Switch to generating new DSL syntax
gvanrossum 65abfc4
Indent output; Always generate stack effect syntax; use argparse
gvanrossum 51dbe28
Check jump flag; tweak begin and end of the script a bit
gvanrossum a238f69
Fix incorrect output for ??--??
gvanrossum 2d5b1b5
Script to generate cases.h from bytecodes.inst
gvanrossum ae042be
Write bytecodes.inst into Python directory by default
gvanrossum 4315621
Initial bytecodes.inst
gvanrossum 8c80bfd
Initial cases.h
gvanrossum 7301203
Changes to ceval.c to use cases.h
gvanrossum d9ac40b
Changes to Makefile.pre.in to generate cases.h
gvanrossum a5bff0c
Move #endif around
gvanrossum 8c13c55
Write families to .inst file
gvanrossum 34c84bf
Derive stack effect for super-instructions and specializations
gvanrossum ff70895
Regenerated bytecodes.inst with fewer errors
gvanrossum 78f8591
Support array stack effects
gvanrossum a29b815
Array stack effects are now in bytecodes.inst
gvanrossum 688bb5d
Add Mark's C lexer
gvanrossum 7def42b
Start writing a real parser
gvanrossum 8fae259
Move cases infrastructure to its own directory
gvanrossum b998a97
Pristine copy of lexer from Mark's gist
gvanrossum c44adad
Fix tiny bits in lexer.py
gvanrossum d0c4398
Move c_lexer.c to lexer.c
gvanrossum 06a3afa
Complete parser (not using it yet):
gvanrossum 33540af
Complete the parser and use it
gvanrossum 1990b61
Use a dataclass for Token; move stuff around to fix tokens
gvanrossum 690d4c5
Make a nice syntax error in lexer.py
gvanrossum b3cd440
More handy stuff for raising syntax errors
gvanrossum 2ed0e15
Fix family definitions per spec
gvanrossum 371050e
Rename bytecodes.{inst,c} in prep for better tooling support
gvanrossum ee59b7d
Use a template to generate top/bottom of bytecodes.c
gvanrossum a782bb1
Add more to bytecodes_template.c
gvanrossum 0ff055a
Let generate_cases.py add the DISPATCH() calls
gvanrossum 8e9b3dc
Refactor the parser in preparation of actually parsing C
gvanrossum a38e52b
Handle PERIOD properly
gvanrossum 5279fe2
CHECKPOINT -- the start of a better C parser
gvanrossum 35eb36a
Merge remote-tracking branch 'origin/main' into generate-ceval-switch
gvanrossum 1869a8b
Add some type hints to lexer.py
gvanrossum 17466fd
Split cparser into sparser and eparser
gvanrossum 96832de
Identifiers are types too (-ish)
gvanrossum 3c9a567
Begin better treatment of types
gvanrossum e751e9a
Begin better declarations
gvanrossum 9e9ddbd
Support any number of postfix operators
gvanrossum 5e90a22
Split declaration; support 'for (int i = 0;...)'
gvanrossum ba3c2ff
Use CHARACTER, not CHAR, for '.' token
gvanrossum 3678d2a
Support string and character literals
gvanrossum 607a22e
Refactor decl_stmt some more
gvanrossum 06247ea
Switch statement (and case and default)
gvanrossum 5ec6a12
String literal concatenation
gvanrossum 5f8a56f
Fix hex and octal numbers
gvanrossum dc7732f
Hack conditional operator
gvanrossum a3c3c72
More numeric types, e.g. unsigned long
gvanrossum 5c91786
Support array declarations and initializers
gvanrossum 4ec2d9b
Fix typo in main
gvanrossum 074be4b
Support some function types in casts
gvanrossum d140ae6
Support function pointer declarations
gvanrossum 2ad6278
Make Context repr more compact
gvanrossum 2f3e321
Make contextual more generic
gvanrossum 64f62c7
Make Parser derive from SParser, and add test main
gvanrossum 250ded1
CHECKPOINT: generate cases the new way
gvanrossum 4efd6bb
Insert DISPATCH() unless block always exits
gvanrossum 01b3735
More accuracy in DISPATCH() addition
gvanrossum 5215027
📜🤖 Added by blurb_it.
blurb-it[bot] df0e8d8
Merge remote-tracking branch 'origin/main' into generate-ceval-switch
gvanrossum 08465c9
Update generated cases due to END_FOR refactor
gvanrossum 6111283
Add some TODO comments to lexer.py
gvanrossum 69c5551
Add README.md to Tools/cases_generator
gvanrossum a7f0c08
Fix trailing whitespace
gvanrossum 46b0def
Fix crash in require() at EOF
gvanrossum e757b61
More compact Token.__repr__()
gvanrossum c67f0ba
Proper operator priorities, add comma operator
gvanrossum 98427bf
Format large families more nicely
gvanrossum 4bbf11e
Rename cases.h to generated_cases.c.h
gvanrossum 1911964
Merge remote-tracking branch 'origin/main' into generate-ceval-switch
gvanrossum 6837c86
Regenerate cases after merging latest main
gvanrossum 6f3c993
Separate family members by commas
gvanrossum 4663dfc
Merge remote-tracking branch 'origin/main' into generate-ceval-switch
gvanrossum 1c587bb
Regenerated files after merge from main
gvanrossum b96f5db
Get rid of the C parser infrastructure
gvanrossum c42d323
Remove stack effect from bytecodes.c
gvanrossum 2eb908d
Update README.md
gvanrossum 53a0398
Merge remote-tracking branch 'origin/main' into generate-ceval-switch
gvanrossum 6ea380f
Add generated_cases.c.h to .gitattributes as generated file
gvanrossum d8e6db8
Update from Brandt's code review
gvanrossum 8a312ca
Merge remote-tracking branch 'origin/main' into generate-ceval-switch
gvanrossum 7a327aa
Update generated files after merging from main
gvanrossum fddc08c
Remove the redundant cases from ceval.c
gvanrossum File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
Misc/NEWS.d/next/Build/2022-10-28-22-24-26.gh-issue-98831.IXRCRX.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
We have new tooling, in ``Tools/cases_generator``, to generate the interpreter switch from a list of opcode definitions. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.