]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
GH-98831: Add `macro` and `op` and their implementation to DSL (#99495)
authorGuido van Rossum <guido@python.org>
Wed, 23 Nov 2022 00:04:57 +0000 (16:04 -0800)
committerGitHub <noreply@github.com>
Wed, 23 Nov 2022 00:04:57 +0000 (16:04 -0800)
commit8f18ac04d32515eab841172c956a8cb14bcee9c3
treeb2c54230bb6a336b40e18c42c0e3cc5f1da41e24
parentf1a4a6a58736196f766d51f048d19a2b0a0a155a
GH-98831: Add `macro` and `op` and their implementation to DSL (#99495)

Newly supported interpreter definition syntax:
- `op(NAME, (input_stack_effects -- output_stack_effects)) { ... }`
- `macro(NAME) = OP1 + OP2;`

Also some other random improvements:
- Convert `WITH_EXCEPT_START` to use stack effects
- Fix lexer to balk at unrecognized characters, e.g. `@`
- Fix moved output names; support object pointers in cache
- Introduce `error()` method to print errors
- Introduce read_uint16(p) as equivalent to `*p`

Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
Include/internal/pycore_code.h
Python/bytecodes.c
Python/generated_cases.c.h
Tools/cases_generator/README.md
Tools/cases_generator/generate_cases.py
Tools/cases_generator/lexer.py
Tools/cases_generator/parser.py