Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4dae216

Browse files
committed
Removed 'dir' statement.
Function call argument is a testlist instead of exprlist.
1 parent c83fd37 commit 4dae216

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

Grammar/Grammar

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
# Grammar for Python, version 3
1+
# Grammar for Python, version 4
2+
3+
# Changes compared to version 3:
4+
# Removed 'dir' statement.
5+
# Function call argument is a testlist instead of exprlist.
26

37
# Changes compared to version 2:
48
# The syntax of Boolean operations is changed to use more
@@ -11,8 +15,6 @@
1115
# 'import' and 'def' aren't special any more;
1216
# added 'from' NAME option on import clause, and '*' to import all;
1317
# added class definition.
14-
# TO DO:
15-
# replace 'dir' by something more general?
1618

1719
# Start symbols for the grammar:
1820
# single_input is a single interactive statement;
@@ -32,12 +34,11 @@ fplist: fpdef (',' fpdef)*
3234
fpdef: NAME | '(' fplist ')'
3335

3436
stmt: simple_stmt | compound_stmt
35-
simple_stmt: expr_stmt | print_stmt | pass_stmt | del_stmt | dir_stmt | flow_stmt | import_stmt
37+
simple_stmt: expr_stmt | print_stmt | pass_stmt | del_stmt | flow_stmt | import_stmt
3638
expr_stmt: (exprlist '=')* exprlist NEWLINE
3739
# For assignments, additional restrictions enforced by the interpreter
3840
print_stmt: 'print' (test ',')* [test] NEWLINE
3941
del_stmt: 'del' exprlist NEWLINE
40-
dir_stmt: 'dir' [expr] NEWLINE
4142
pass_stmt: 'pass' NEWLINE
4243
flow_stmt: break_stmt | return_stmt | raise_stmt
4344
break_stmt: 'break' NEWLINE
@@ -61,7 +62,7 @@ expr: term (('+'|'-') term)*
6162
term: factor (('*'|'/'|'%') factor)*
6263
factor: ('+'|'-') factor | atom trailer*
6364
atom: '(' [testlist] ')' | '[' [testlist] ']' | '{' '}' | '`' testlist '`' | NAME | NUMBER | STRING
64-
trailer: '(' [exprlist] ')' | '[' subscript ']' | '.' NAME
65+
trailer: '(' [testlist] ')' | '[' subscript ']' | '.' NAME
6566
subscript: expr | [expr] ':' [expr]
6667
exprlist: expr (',' expr)* [',']
6768
testlist: test (',' test)* [',']

0 commit comments

Comments
 (0)