Update grammar (#61)
* Update spec
Octal numbers syntax + fix bugs in grammar
* Update grammar.txt
diff --git a/doc/spec.md b/doc/spec.md
index 3b49ca3..780d83a 100644
--- a/doc/spec.md
+++ b/doc/spec.md
@@ -311,6 +311,7 @@
int = decimal_lit | octal_lit | hex_lit | binary_lit .
decimal_lit = ('1' … '9') {decimal_digit} .
octal_lit = '0' {octal_digit} .
+ | '0' ('o'|'O') octal_digit {octal_digit} .
hex_lit = '0' ('x'|'X') hex_digit {hex_digit} .
binary_lit = '0' ('b'|'B') binary_digit {binary_digit} .
@@ -2066,7 +2067,7 @@
CallSuffix = '(' [Arguments] ')' .
Arguments = Argument {',' Argument} .
-Argument = identifier | identifier '=' Test | '*' identifier | '**' identifier .
+Argument = Test | identifier '=' Test | '*' identifier | '**' identifier .
```
A value `f` of type `function` or `builtin_function_or_method` may be called using the expression `f(...)`.
@@ -2474,7 +2475,7 @@
value to the caller of the function.
```grammar {.good}
-ReturnStmt = 'return' Expression .
+ReturnStmt = 'return' [Expression] .
```
A return statement may have zero, one, or more
diff --git a/syntax/grammar.txt b/syntax/grammar.txt
index d2ab419..6d914e0 100644
--- a/syntax/grammar.txt
+++ b/syntax/grammar.txt
@@ -16,7 +16,7 @@
ForStmt = 'for' LoopVariables 'in' Expression ':' Suite .
-Suite = [newline indent {Statement} outdent] SimpleStmt .
+Suite = [newline indent {Statement} outdent] | SimpleStmt .
SimpleStmt = SmallStmt {';' SmallStmt} [';'] '\n' .
# NOTE: '\n' optional at EOF
@@ -28,7 +28,7 @@
| LoadStmt
.
-ReturnStmt = 'return' Expression .
+ReturnStmt = 'return' [Expression] .
BreakStmt = 'break' .
ContinueStmt = 'continue' .
PassStmt = 'pass' .
@@ -67,7 +67,7 @@
SliceSuffix = '[' [Expression] [':' Test [':' Test]] ']' .
Arguments = Argument {',' Argument} .
-Argument = identifier | identifier '=' Test | '*' identifier | '**' identifier .
+Argument = Test | identifier '=' Test | '*' identifier | '**' identifier .
ListExpr = '[' [Expression [',']] ']' .
ListComp = '[' Test {CompClause} ']'.