Skip to content

Commit

Permalink
ast diff
Browse files Browse the repository at this point in the history
  • Loading branch information
loechel committed Oct 12, 2020
1 parent 306a846 commit 5c71848
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 54 deletions.
102 changes: 51 additions & 51 deletions docs/contributing/ast/python3_9.ast
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-- Python 3.8 AST
-- Python 3.9 AST
-- ASDL's 4 builtin types are:
-- identifier, int, string, constant

Expand All @@ -10,57 +10,57 @@ module Python version "3.9"
| FunctionType(expr* argtypes, expr returns)

stmt = FunctionDef(identifier name,
arguments args,
stmt* body,
expr* decorator_list,
expr? returns,
string? type_comment)
| AsyncFunctionDef(identifier name,
arguments args,
stmt* body,
expr* decorator_list,
expr? returns,
string? type_comment)

| ClassDef(identifier name,
expr* bases,
keyword* keywords,
arguments args,
stmt* body,
expr* decorator_list)
| Return(expr? value)

| Delete(expr* targets)
| Assign(expr* targets, expr value, string? type_comment)
| AugAssign(expr target, operator op, expr value)
-- 'simple' indicates that we annotate simple name without parens
| AnnAssign(expr target, expr annotation, expr? value, int simple)

-- use 'orelse' because else is a keyword in target languages
| For(expr target, expr iter, stmt* body, stmt* orelse, string? type_comment)
| AsyncFor(expr target, expr iter, stmt* body, stmt* orelse, string? type_comment)
| While(expr test, stmt* body, stmt* orelse)
| If(expr test, stmt* body, stmt* orelse)
| With(withitem* items, stmt* body, string? type_comment)
| AsyncWith(withitem* items, stmt* body, string? type_comment)

| Raise(expr? exc, expr? cause)
| Try(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody)
| Assert(expr test, expr? msg)

| Import(alias* names)
| ImportFrom(identifier? module, alias* names, int? level)

| Global(identifier* names)
| Nonlocal(identifier* names)
| Expr(expr value)
| Pass
| Break
| Continue

-- col_offset is the byte offset in the utf8 string the parser uses
attributes (int lineno, int col_offset, int? end_lineno, int? end_col_offset)

-- BoolOp() can use left & right?
expr* decorator_list,
expr? returns,
string? type_comment)
| AsyncFunctionDef(identifier name,
arguments args,
stmt* body,
expr* decorator_list,
expr? returns,
string? type_comment)

| ClassDef(identifier name,
expr* bases,
keyword* keywords,
stmt* body,
expr* decorator_list)
| Return(expr? value)

| Delete(expr* targets)
| Assign(expr* targets, expr value, string? type_comment)
| AugAssign(expr target, operator op, expr value)
-- 'simple' indicates that we annotate simple name without parens
| AnnAssign(expr target, expr annotation, expr? value, int simple)

-- use 'orelse' because else is a keyword in target languages
| For(expr target, expr iter, stmt* body, stmt* orelse, string? type_comment)
| AsyncFor(expr target, expr iter, stmt* body, stmt* orelse, string? type_comment)
| While(expr test, stmt* body, stmt* orelse)
| If(expr test, stmt* body, stmt* orelse)
| With(withitem* items, stmt* body, string? type_comment)
| AsyncWith(withitem* items, stmt* body, string? type_comment)

| Raise(expr? exc, expr? cause)
| Try(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody)
| Assert(expr test, expr? msg)

| Import(alias* names)
| ImportFrom(identifier? module, alias* names, int? level)

| Global(identifier* names)
| Nonlocal(identifier* names)
| Expr(expr value)
| Pass
| Break
| Continue

-- col_offset is the byte offset in the utf8 string the parser uses
attributes (int lineno, int col_offset, int? end_lineno, int? end_col_offset)

-- BoolOp() can use left & right?
expr = BoolOp(boolop op, expr* values)
| NamedExpr(expr target, expr value)
| BinOp(expr left, operator op, expr right)
Expand Down
6 changes: 3 additions & 3 deletions docs/contributing/changes_from38to39.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Changes from Python 3.7 to Python 3.8
Changes from Python 3.8 to Python 3.9
-------------------------------------

.. literalinclude:: ast/python3_8.ast
:diff: ast/python3_7.ast
.. literalinclude:: ast/python3_9.ast
:diff: ast/python3_8.ast

0 comments on commit 5c71848

Please sign in to comment.