decoration decoration
Stories

GROKLAW
When you want to know more...
decoration
For layout only
Home
Archives
Site Map
Search
About Groklaw
Awards
Legal Research
Timelines
ApplevSamsung
ApplevSamsung p.2
ArchiveExplorer
Autozone
Bilski
Cases
Cast: Lawyers
Comes v. MS
Contracts/Documents
Courts
DRM
Gordon v MS
GPL
Grokdoc
HTML How To
IPI v RH
IV v. Google
Legal Docs
Lodsys
MS Litigations
MSvB&N
News Picks
Novell v. MS
Novell-MS Deal
ODF/OOXML
OOXML Appeals
OraclevGoogle
Patents
ProjectMonterey
Psystar
Quote Database
Red Hat v SCO
Salus Book
SCEA v Hotz
SCO Appeals
SCO Bankruptcy
SCO Financials
SCO Overview
SCO v IBM
SCO v Novell
SCO:Soup2Nuts
SCOsource
Sean Daly
Software Patents
Switch to Linux
Transcripts
Unix Books

Gear

Groklaw Gear

Click here to send an email to the editor of this weblog.


You won't find me on Facebook


Donate

Donate Paypal


No Legal Advice

The information on Groklaw is not intended to constitute legal advice. While Mark is a lawyer and he has asked other lawyers and law students to contribute articles, all of these articles are offered to help educate, not to provide specific legal advice. They are not your lawyers.

Here's Groklaw's comments policy.


What's New

STORIES
No new stories

COMMENTS last 48 hrs
No new comments


Sponsors

Hosting:
hosted by ibiblio

On servers donated to ibiblio by AMD.

Webmaster
Thats a bit advanced | 319 comments | Create New Account
Comments belong to whoever posts them. Please notify us of inappropriate comments.
That was two programs, not one.
Authored by: jesse on Friday, May 18 2012 @ 06:54 PM EDT
As no executable statements can follow END - only DATA :)

[ Reply to This | Parent | # ]

Thats a bit advanced
Authored by: Anonymous on Saturday, May 19 2012 @ 02:20 AM EDT

Bzzzt. No.

They're not duplicate line numbers; if you were to try those two programs /in the same machine/ (circa 1980, eg a Commodore PET) you would find that after entering the first, the output would be:

HELLO WORLD

and then enter the second *WITHOUT* using a NEW command, the output would be:

HAVE A GREAT WEEKEND :)
PATRICK.

a completely different program - using the command LIST, the output would be:

10 PRINT "HAVE A GREAT WEEKEND :)"
20 PRINT "PATRICK."
99 END

In entering the program, the new lines 10 & 99 would replace the original lines 10 & 99 - the line numbers are symbolic references (DOH!) to "pigeon holes" that hold the lines of the program; if the same line number is used, the contents of its "pigeon hole" get replaced. These symbolic references (BHA!) can also be used as the destination of a GOTO, for example, adding:

40 GOTO 10

would mean that the program then looped forever, as when it reached executing that line, it would search (from the beginning of the program) for a line with that number and then continue execution form that point, printing out the text again, and again, and again, and... until it was stopped somehow.

Only in more "modern" BASICS is it where every line does not have to have a number and they are compiled (either to machine code or a byte code which is then interpreted); in these cases, they are more akin to the labels used in scripts, etc.

Which brings me to my experience of three different BASICS I've used and how they store and run their programs:

  1. The Acorn Atom (1980-1982)
    This stored its programs (with every line numbered) as plain ASCII with no interpretation at entry time - it read "words" at a time and then interpreted them to find keywords to call (machine code) subroutines for PRINT, etc which then interpreted their arguments from the program code.
  2. The Commodore PET [3000/4000 series] (circa 1980-1983)
    This stored it programs (with every line numbered) by interpreting "words" at entry time to convert keywords into a byte code which was an offset into a jump table so that calling the (machine code) subroutines was faster; the subroutines still interpreted their arguments from the program code.
  3. [Pick] DataBASIC (circa? programmed 1985-94)
    This required programs to be stored in a standard file/item as a plain text file which was then compiled to a byte code; only lines which were the destination of a GOTO or GOSUB needed to be numbered (more a "symbolic reference"). During the compilation, the program was "rewritten" to convert expressions into reverse polish notation; variables (dynamic arrays) were stored as an address (offset from the base of the variable storage), destinations of GOTOs and GOSUBs stored as an address (offset relative to start of the program); and the whole byte code interpreted.

[ Reply to This | Parent | # ]

Thats a bit advanced
Authored by: Steve Martin on Saturday, May 19 2012 @ 06:41 AM EDT
Gee... sorry, guys, I guess I should have included explicit <humor> tags.



---
"When I say something, I put my name next to it." -- Isaac Jaffe, "Sports Night"

[ Reply to This | Parent | # ]

Groklaw © Copyright 2003-2013 Pamela Jones.
All trademarks and copyrights on this page are owned by their respective owners.
Comments are owned by the individual posters.

PJ's articles are licensed under a Creative Commons License. ( Details )