|
|
@ -6,7 +6,7 @@ b-rem : REM
|
|
|
|
@b-statement : b-end | b-print | b-goto
|
|
|
|
@b-statement : b-end | b-print | b-goto
|
|
|
|
| b-let | b-input | b-if
|
|
|
|
| b-let | b-input | b-if
|
|
|
|
| b-gosub | b-return | b-for | b-next
|
|
|
|
| b-gosub | b-return | b-for | b-next
|
|
|
|
| b-def | b-require
|
|
|
|
| b-def | b-import
|
|
|
|
b-end : /"end"
|
|
|
|
b-end : /"end"
|
|
|
|
b-print : /"print" [b-printable] (/";" [b-printable])*
|
|
|
|
b-print : /"print" [b-printable] (/";" [b-printable])*
|
|
|
|
@b-printable : STRING | b-expr
|
|
|
|
@b-printable : STRING | b-expr
|
|
|
@ -20,10 +20,9 @@ b-gosub : /"gosub" b-expr
|
|
|
|
b-return : /"return"
|
|
|
|
b-return : /"return"
|
|
|
|
b-for : /"for" b-id /"=" b-expr /"to" b-expr [/"step" b-expr]
|
|
|
|
b-for : /"for" b-id /"=" b-expr /"to" b-expr [/"step" b-expr]
|
|
|
|
b-next : /"next" b-id
|
|
|
|
b-next : /"next" b-id
|
|
|
|
b-def : /"def" b-id /"(" b-var-list /")" /"=" b-expr
|
|
|
|
b-def : /"def" b-id /"(" ID [/"," ID]* /")" /"=" b-expr
|
|
|
|
@b-var-list : ID [/"," ID]*
|
|
|
|
b-import : /"import" b-import-spec
|
|
|
|
b-require : /"require" b-require-spec
|
|
|
|
@b-import-spec : (ID | STRING)
|
|
|
|
@b-require-spec : ID | STRING
|
|
|
|
|
|
|
|
b-expr : b-or-expr
|
|
|
|
b-expr : b-or-expr
|
|
|
|
b-or-expr : [b-or-expr "or"] b-and-expr
|
|
|
|
b-or-expr : [b-or-expr "or"] b-and-expr
|
|
|
|
b-and-expr : [b-and-expr "and"] b-not-expr
|
|
|
|
b-and-expr : [b-and-expr "and"] b-not-expr
|
|
|
@ -34,7 +33,6 @@ b-product : [b-product ("*"|"/"|"mod")] b-neg
|
|
|
|
b-neg : ["-"] b-expt
|
|
|
|
b-neg : ["-"] b-expt
|
|
|
|
b-expt : [b-expt ("^")] b-value
|
|
|
|
b-expt : [b-expt ("^")] b-value
|
|
|
|
@b-value : b-number | b-id | /"(" b-expr /")" | b-func
|
|
|
|
@b-value : b-number | b-id | /"(" b-expr /")" | b-func
|
|
|
|
b-func : ID /"(" b-input-list /")"
|
|
|
|
b-func : b-id /"(" b-expr [/"," b-expr]* /")"
|
|
|
|
@b-input-list : (ID | b-expr) [/"," (ID | b-expr)]*
|
|
|
|
|
|
|
|
@b-number : INTEGER | DECIMAL
|
|
|
|
@b-number : INTEGER | DECIMAL
|
|
|
|
b-repl : (b-statement | b-expr) (/":" [b-repl])*
|
|
|
|
b-repl : (b-statement | b-expr) (/":" [b-repl])*
|