From c2587c76f1b416cdbecb979e54941933246bf856 Mon Sep 17 00:00:00 2001 From: Skip Montanaro Date: Tue, 16 Feb 2021 20:14:16 -0600 Subject: starting over --- src/Grammar | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'src/Grammar') diff --git a/src/Grammar b/src/Grammar index 574acd6..a6169d1 100644 --- a/src/Grammar +++ b/src/Grammar @@ -1,26 +1,26 @@ # Grammar for Python, version 4 # Changes compared to version 3: -# Removed 'dir' statement. -# Function call argument is a testlist instead of exprlist. +# Removed 'dir' statement. +# Function call argument is a testlist instead of exprlist. # Changes compared to version 2: -# The syntax of Boolean operations is changed to use more -# conventional priorities: or < and < not. +# The syntax of Boolean operations is changed to use more +# conventional priorities: or < and < not. # Changes compared to version 1: -# modules and scripts are unified; -# 'quit' is gone (use ^D); -# empty_stmt is gone, replaced by explicit NEWLINE where appropriate; -# 'import' and 'def' aren't special any more; -# added 'from' NAME option on import clause, and '*' to import all; -# added class definition. +# modules and scripts are unified; +# 'quit' is gone (use ^D); +# empty_stmt is gone, replaced by explicit NEWLINE where appropriate; +# 'import' and 'def' aren't special any more; +# added 'from' NAME option on import clause, and '*' to import all; +# added class definition. # Start symbols for the grammar: -# single_input is a single interactive statement; -# file_input is a module or sequence of commands read from an input file; -# expr_input is the input for the input() function; -# eval_input is the input for the eval() function. +# single_input is a single interactive statement; +# file_input is a module or sequence of commands read from an input file; +# expr_input is the input for the input() function; +# eval_input is the input for the eval() function. # NB: compound_stmt in single_input is followed by extra NEWLINE! single_input: NEWLINE | simple_stmt | compound_stmt NEWLINE @@ -34,7 +34,7 @@ fplist: fpdef (',' fpdef)* fpdef: NAME | '(' fplist ')' stmt: simple_stmt | compound_stmt -simple_stmt: expr_stmt | print_stmt | pass_stmt | del_stmt | flow_stmt | import_stmt +simple_stmt: expr_stmt | print_stmt | pass_stmt | del_stmt | flow_stmt | import_stmt expr_stmt: (exprlist '=')* exprlist NEWLINE # For assignments, additional restrictions enforced by the interpreter print_stmt: 'print' (test ',')* [test] NEWLINE -- cgit v1.2.3