kolibrios-gitea/programs/develop/tinybasic-1.0.4/doc/specification.bnf
turbocat 43795ab11a Added new port TinyBasic
(An improved version in conjunction with ktcc can generate executable files.)

git-svn-id: svn://kolibrios.org@8733 a494cfbc-eb01-0410-851d-a64ba20cac60
2021-05-23 15:55:49 +00:00

62 lines
1.1 KiB
BNF

<line> ::=
<number> <statement> <EOL> | <statement> <EOL>
<statement> ::=
"REM" <printable-characters> |
"PRINT" <output-list> |
"IF" <expression> <relational-operator> <expression> "THEN" <statement> |
"GOTO" <expression> |
"INPUT" <variable-list> |
"LET" <variable> "=" <expression> |
"GOSUB" <expression> |
"RETURN" |
"END"
<printable-characters> ::=
<printable-character> | <printable-character> <printable-characters>
<printable-character> ::=
" " .. "~"
<output-list> ::=
<output-term> | <output-term> "," <output-list>
<output-term> ::=
<string> | <expression>
<variable-list> ::=
<variable> | <variable> "," <variable-list>
<expression> ::=
<term> |
<expression> "+" <expression> |
<expression> "-" <expression>
<term> ::=
<factor> |
<term> "*" <term> |
<term> "/" <term>
factor ::=
"-" <factor> |
"+" <factor> |
<variable> |
<number> |
"(" <expression> ")"
<variable> ::=
"A" .. "Z"
<number> ::=
<digit> | <digit> <number>
<digit> ::=
"0" .. "9"
<relational-operator> ::=
"<" | "=" | ">" | "<=" | "<>" | ">="
<string> ::=
'"' <printable-characters> '"'