Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Tiny BASIC
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Formal grammar=== The grammar is listed below in [[Backus–Naur form]], almost exactly as it was specified in the Design Note.<ref>{{cite magazine |title=Build Your Own BASIC |first=Dennis |last=Allison |magazine=Dr. Dobb's Journal |volume=1 |number=1 |date=1976 |url=https://archive.org/details/dr_dobbs_journal_vol_01/page/n9 |page=9}}</ref> In the listing, an asterisk ("<code>*</code>") denotes zero or more of the object to its left{{snd}} except for the first asterisk in the definition of "<code>term</code>", which is the multiplication operator; parentheses group objects; and an epsilon ("<code>ε</code>") signifies the empty string. As is common in computer language grammar notation, the vertical bar ("<code>|</code>") distinguishes alternatives, as does their being listed on separate lines. The symbol "<code>CR</code>" denotes a [[carriage return]] (usually generated by a keyboard's "Enter" key). A BREAK from the console will interrupt execution of the program. <!-- Note: there might be some typos in the listing, which IIRC is an exact copy of the DrD original. A correction of those errors would have to be shown with (foot)notes, so that the reader will be presented with the original text as printed in the DrD. --Wernher --> <syntaxhighlight lang="abnf"> line ::= number statement CR | statement CR statement ::= PRINT expr-list IF expression relop expression THEN statement GOTO expression INPUT var-list LET var = expression GOSUB expression RETURN CLEAR LIST RUN END expr-list ::= (string|expression) (, (string|expression) )* var-list ::= var (, var)* expression ::= (+|-|ε) term ((+|-) term)* term ::= factor ((*|/) factor)* factor ::= var | number | (expression) var ::= A | B | C ... | Y | Z number ::= digit digit* digit ::= 0 | 1 | 2 | 3 | ... | 8 | 9 relop ::= < (>|=|ε) | > (<|=|ε) | = string ::= " ( |!|#|$ ... -|.|/|digit|: ... @|A|B|C ... |X|Y|Z)* " </syntaxhighlight> Note that string wasn't defined in the Design Note. This syntax, as simple as it was, added one innovation: {{code|GOTO}} and {{code|GOSUB}} could take an expression rather than just a line number, providing an [[Goto#Computed GOTO and Assigned GOTO|assigned GOTO]]<ref>{{cite magazine |title=Quick Reference Guide for Tiny BASIC |first=Dennis |last=Allison |magazine=Dr. Dobb's Journal |volume=1 |number=1 |date=1976 |url=https://archive.org/details/dr_dobbs_journal_vol_01/page/n6 |page=6}}</ref> rather than the [[switch statement]] of the {{code|GOTO/GOSUB ... OF ...}}, a structure then supported in [[HP Time-Shared BASIC]] and predating {{code|ON ... GOTO}}. The syntax allowing {{code|IF-THEN statement}} (as opposed to just a line number to branch to) was not yet supported in Dartmouth BASIC at this time but had been introduced by Digital<ref>{{cite book|url=https://archive.org/details/bitsavers_decpdp11rsSICPLUSLangManOct72_10455777|title=BASIC-PLUS Language Manual|publisher=Digital Equipment Corporation|year=1972|location=Maynard, Massachusetts|type=PDF|pages=3–13|ref=CITEREFPLUS1972}}</ref> and copied by Microsoft.
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Tiny BASIC
(section)
Add topic