Extentions to BASIC

Jun 14, 2009 24 Replies

Here I will introduce you to a number of new BASIC statements that add power to that language, and will hopefully make programming easier for those of you who are used to discussing subjects on Usenet.


The first new statement we will address today is the BEFORE statement.



The BEFORE statement makes it easier for the programmer to correct a mistake without changing the structure of the program. Here is an example:


10 PRINT "ARE THE GREATEST"
20 END
50 BEFORE 10
60 PRINT "WE AT HILLVIEW"
70 ANYWAYS
80 PRINT "OUR SOFTWARE IS 100% BUG FREE"


When run, this code produces the following output: WE AT HILLVIEW ARE THE GREATEST OUR SOFTWARE IS 100% BUG FREE


The ANYWAYS statement introduced above, terminates a BEFORE, BEFORE statement are also terminated by a BTWWW (BackToWhereWeWhere) statement. BTWWW and ANYWAYS have the same function, so


10 PRINT "ARE THE GREATEST"
20 END
50 BEFORE 10
60 PRINT "WE AT HILLVIEW"
70 BTWWW
80 PRINT "OUR SOFTWARE IS 100 % BUG FREE" produces the same output as the first example: WE AT HILLVIEW ARE THE GREATEST OUR SOFTWARE IS 100 % BUG FREE


The next new statement I want to introduce you to, is the AFTER statement. The AFTER statement makes it easier to execute things later, here and example of it's use:


10 PRINT "BASIC NEEDS TO BE EXTENDED WITH MORE USEFUL COMMANDS"
20 AFTER 100
30 PRINT "BECAUSE I SAY SO"
40 ANYWAYS
50 PRINT "TO MAKE PROGRAMMING EASIER FOR COMMON PEOPLE AND ENGINEERS"
100 PRINT
110 PRINT "AND IT IS SIMPLE"

This shall produce the following output:



BASIC NEEDS TO BE EXTENDED WITH MORE USEFUL COMMANDS TO MAKE PROGRAMMING EASIER FOR COMMON PEOPLE AND ENGINEERS



BECAUSE I SAY SO AND IT IS SIMPLE



The ANYWAYS statement is here again used to terminate an AFTER directive.


The last statement I will introduce you to today is the NEVER statement. Here and example of the use of NEVER:


10 PRINT "OUR SOFTWARE IS THE BEST
20 PRINT "IS HAS SOME MINOR BUGS, BUT WE ARE WORKING VERY HARD TO FIX THESE"
30 PRINT "THIS ENDS OUR LESSON FOR TODAY"
40 NEVER 20
50 AFTER 20
60 PRINT "OUR SOFTWARE HAS NO BUGS"
70 BTWWW
80 END


The output for this example is:



OUR SOFTWARE IS THE BEST OUR SOFTWARE HAS NO BUGS THIS ENDS OUR LESSON FOR TODAY


Dr Dun Never



2028DIM Hillview Drive Atlantis

of it's use:

I'm glad I don't use compiler languages with your thoughts in mind.

of it's use:

And I'm glad I don't pay to see comedy shows that this clod writes.

John

example of it's use:

No "do what I mean, not what I say" instruction?

example of it's use:

I believe that Dr Num Nuts was the proud author of this:

formatting link

and

formatting link

John

mistake

example of it's use:

THESE"

$ gcc anonymous.c anonymous.c:7:29: warning: missing whitespace after the macro name anonymous.c:9:27: warning: missing whitespace after the macro name anonymous.c:13:23: warning: missing whitespace after the macro name anonymous.c: In function 'main': anonymous.c:39: warning: pointer/integer type mismatch in conditional expression gcc hoyle.c /tmp/cctsyZlc.o: In function inIine': hoyle.c:(.text+0x50): undefined reference to pow' collect2: ld returned 1 exit status

gcc hoyle.c /tmp/cctsyZlc.o: In function inIine': hoyle.c:(.text+0x50): undefined reference to pow' collect2: ld returned 1 exit status

mistake

example of it's use:

THESE"

Yup, must have been him.

John

hoyle.c needs libm for the pow function, so build with gcc hoyle.c

-lm. Or get the Makefile too from

formatting link
it can build all the 2004 entries... That hoyle.c seems like a neat little ascii function plotter.

That "anonymous" program converts its argument to Tolkien's Elvish letters and outputs a bitmap... Or it's supposed to, but the output seems short. Maybe it needs input in Elvish written in ASCII...

We need a COMEFROM statement, to help debug spaghetti code. ;-)

Cheers! Rich

I'd rather stick to VALGOL (Vally Girl extensions to ALGOL):

14 LIKE, Y$KNOW (I MEAN) START %% IF PI A =LIKE BITCHEN AND 01 B =LIKE TUBULAR AND 9C =LIKE GRODY^MAX 4K (FERSURE)^2 18 THEN 4I FOR I= LIKE 1 TO OH MAYBE 100 86 DO WAH + (DITTY^2) 9 BARF(I) =TOTALLY GROSS(OUT)

-17 SURE

1F LIKE BAG THIS PROGRAM ? REALLY $$ LIKE TOTALLY (Y$KNOW)
Paul Hovnanian mailto:Paul@Hovnanian.com ------------------------------------------------------------------ Deja fubar: The feeling that you\'ve made the same mistake before.

There's a blast from the past. I think I first saw that in '82.

formatting link

Since this thread started with BASIC:

SIMPLE

SIMPLE is an acronym for Sheer Idiot's Monopurpose Programming Linguistic Environment. This language, developed at the Hanover College for Technical Misfits, was designed to make it impossible to write code with errors in it. The statements are, therefore confined to BEGIN, END, and STOP. No matter how you arrange the statements, you can't make a syntax error. Programs written in SIMPLE do nothing useful. Thus they achieve the results of programs written in other languages without the tedious, frustrating process of testing and debugging.

And there's the universal ASIF ... WHATEVER construct.

John

t can build all the 2004

Hmm... compiles on bcc32 but gives a bunch of pow domain errors.

anonymous.c simply crashed on WinXP.

What does anonymous.c do?

Michael

First

it can build all the 2004

Ah...

formatting link

Here's some more history:

Creators admit UNIX and C is [sic] a hoax In an announcement that has stunned the computer industry, Ken Thompson, Dennis Ritchie and Brian Kerninghan admitted that the Unix operating system and C programming language created by them is an elaborate April Fools prank kept alive for over 20 years. Speaking at the recent UnixWorld Software Development Forum, Thompson revealed the following: "In 1969, AT&T had just terminated their work with the GE/Honeywell/AT&T Multics project. Brian and I had just started working with an early release of Pascal from Professor Nichlaus Wirth's ETH labs in Switzerland and we were impressed with its elegant simplicity and power. Dennis had just finished reading 'Bored of the Rings', a hilarious National Lampoon parody of the great Tolkien 'Lord of the Rings' trilogy. As a lark, we decided to do parodies of the Multics environment and Pascal.

Dennis and I were responsible for the operating environment. We looked at Multics and designed the new system to be as complex and cryptic as possible to maximize casual users' frustration levels, calling it Unix as a parody of Multics, as well as other more risque allusions. Then Dennis and Brian worked on a truly warped version of Pascal, called 'A'. When we found others were actually trying to create real programs with A, we quickly added additional cryptic features and evolved into B, BCPL and finally C.

We stopped when we got a clean compile on the following syntax:

for(;P("\\n"),R-;P("|"))for(e=C;e-;P("_"+(*u++/8)%2))P("| "+(*u/4)%2);

To think that modern programmers would try to use a language that allowed such a statement was beyond our comprehension! We actually thought of selling this to the Soviets to set their computer science progress back 20 or more years. Imagine our surprise when AT&T and other US corporations actually began trying to use Unix and C! It has taken them 20 years to develop enough expertise to generate even marginally useful applications using this 1960's technological parody, but we are impressed with the tenacity (if not common sense) of the general Unix and C programmer.

In any event, Brian, Dennis and I have been working exclusively in Pascal on the Apple Macintosh for the past few years and feel really guilty about the chaos, confusion, and truly bad programming that have resulted from our silly prank so long ago."

Major Unix an C vendors and customers, including AT&T, Microsoft, Hewlett-Packard, GTE, NCR, and DEC have refused comment at this time. Borland International, a leading vendor of Pascal and C tools, including the popular Trubo Pascal, Turbo C and Turbo C++, stated they had suspected this for a number of years and would continue to enhance their Pascal products and halt further efforts to develop C. An IBM spokesman broke into uncontrolled laughter and had to postpone a hastily convened news conference concerning the fate of the RS-6000, merely stated that 'VM will be available Real Soon Now'. In a cryptic statement, Professor Wirth of the ETH institute and father of the Pascal, Modula 2 and Oberon structured languages, merely stated that P.T. Barnum was correct.

In a related late-breaking story, usually reliable sources are stating that a similar confession may be forthcoming from William Gates concerning the MS-DOS and Windows operating environments. And IBM spokesmen have begun denying that the Virtual Machine (VM) product is an internal prank gone awry.

Paul Hovnanian mailto:Paul@Hovnanian.com ------------------------------------------------------------------ Due to recent budget cuts, the light at the end of the tunnel has temporarily been turned off.

...

Yeah, but what's the alternative, when you're writing, say, an OS? ;-) BASIC? COBOL? FORTRAN? Pascal?

***ASSEMBLY?!?!?!??!??*** =:-O

Thanks! Rich

APL Octave

Brainfuck...

++++++++++[>+++++++>++++++++++>+++>+.
Andrew

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required