mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00

This change implements a new bytecode compiler, based on a transformation of the parse tree to an abstract syntax defined in Parser/Python.asdl. The compiler implementation is not complete, but it is in stable enough shape to run the entire test suite excepting two disabled tests.
68 lines
1.4 KiB
Text
68 lines
1.4 KiB
Text
test_grammar
|
|
1. Parser
|
|
1.1 Tokens
|
|
1.1.1 Backslashes
|
|
1.1.2 Numeric literals
|
|
1.1.2.1 Plain integers
|
|
1.1.2.2 Long integers
|
|
1.1.2.3 Floating point
|
|
1.1.3 String literals
|
|
1.2 Grammar
|
|
single_input
|
|
file_input
|
|
expr_input
|
|
eval_input
|
|
funcdef
|
|
lambdef
|
|
simple_stmt
|
|
expr_stmt
|
|
print_stmt
|
|
1 2 3
|
|
1 2 3
|
|
1 1 1
|
|
extended print_stmt
|
|
1 2 3
|
|
1 2 3
|
|
1 1 1
|
|
hello world
|
|
del_stmt
|
|
pass_stmt
|
|
flow_stmt
|
|
break_stmt
|
|
continue_stmt
|
|
continue + try/except ok
|
|
continue + try/finally ok
|
|
testing continue and break in try/except in loop
|
|
return_stmt
|
|
yield_stmt
|
|
raise_stmt
|
|
import_name
|
|
import_from
|
|
global_stmt
|
|
exec_stmt
|
|
assert_stmt
|
|
if_stmt
|
|
while_stmt
|
|
for_stmt
|
|
try_stmt
|
|
suite
|
|
test
|
|
comparison
|
|
binary mask ops
|
|
shift ops
|
|
additive ops
|
|
multiplicative ops
|
|
unary ops
|
|
selectors
|
|
|
|
atoms
|
|
classdef
|
|
['Apple', 'Banana', 'Coco nut']
|
|
[3, 6, 9, 12, 15]
|
|
[3, 4, 5]
|
|
[(1, 'Apple'), (1, 'Banana'), (1, 'Coconut'), (2, 'Apple'), (2, 'Banana'), (2, 'Coconut'), (3, 'Apple'), (3, 'Banana'), (3, 'Coconut'), (4, 'Apple'), (4, 'Banana'), (4, 'Coconut'), (5, 'Apple'), (5, 'Banana'), (5, 'Coconut')]
|
|
[(1, 'Banana'), (1, 'Coconut'), (2, 'Banana'), (2, 'Coconut'), (3, 'Banana'), (3, 'Coconut'), (4, 'Banana'), (4, 'Coconut'), (5, 'Banana'), (5, 'Coconut')]
|
|
[[1], [1, 1], [1, 2, 4], [1, 3, 9, 27], [1, 4, 16, 64, 256]]
|
|
[False, False, False]
|
|
[[1, 2], [3, 4], [5, 6]]
|
|
[('Boeing', 'Airliner'), ('Boeing', 'Engine'), ('Ford', 'Engine'), ('Macdonalds', 'Cheeseburger')]
|