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