Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Tiny BASIC
(section)
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.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)