Author Topic: Beginner friendly BASICs  (Read 11790 times)

Richly

  • Guest
Beginner friendly BASICs
« on: September 13, 2018, 09:30:21 PM »
Inspired by the last discussion...

BASIC was designed for beginners and for ordinary people (i.e. Non-professionals) like me  :)

What in your opinion is (can include retro / retro style BASICS  ;)) the most beginner friendly BASIC - and why?

B+

  • Guest
Re: Beginner friendly BASICs
« Reply #1 on: September 13, 2018, 11:55:30 PM »
BRUN (Very Basic Interpreter) written by yours truly.

Here is the entire instruction manual (41 lines but I think it is missing the array instruction).
Quote
. 000 BRUN Help B.txt for BRUN (B+=MGA) 2018-02-07
. (all lines here are print lines except the next which wont show on run)
. A word about words, a word is whatever island is isolated by the sea of spaces.
. To avoid punctuation, all lines start with keyword commands:
. ===========================================================================================================  VARIABLES
. Number variables are set st n is first letter on line, variable name is next, and variable expression last.
. Use up to 250 "words" for variable and expression including previous number variables, operators: +-*/^%()<=>
. constants: e, pi, rnd   trig functions (radians): cos(), sin(), tan(), atan(), conversion: rad(), deg()
. log(), exp(), operators using <, =, >, (and combinations) and, or, not need to be separated by spaces.
. example:
. i = i + 1 becomes >>>>>   n i i+1
. angle = deg(atan(1.01) becomes >  n angle deg(atan(1.01))
. A couple of calculator programs are in the samples files to try the math evaluator.
. ===========================================================================================================  OUTPUT
. For printing text:
.   . for print with line feed,     , for print and tab,      ; for print and stop
. rc row col    - for locating next character cell for print or input place
. at x y text   - for locating with graphic x, y pixel positions
. cls  - to clear clutter
. variables in print text will be replaced by their values, so be careful using variable names in print text.
. When there is more than one parameter be careful not to use a space in a calculated row, col, x, y
. =========================================================================================================== INPUT
. syntax: ? is keyword, variable name, use 250 words for prompt.
. ? var prompt
. ===========================================================================================================  EXECUTION FLOW
. mark lineLabel - sets line label in program
. go lineLabel - redirects flow to mark lineLabel
. sub subLabel - marks start of gosub routine
. gosub subLabel - redirects flow to sub routine
. return - signals exit back to call point of sub routine
. ( do not enter or exit a sub with go )
. wait - will pause the given amount of seconds
. end - will end program
. ===========================================================================================================  LOOPING
. do - marks start of loop
. loop - marks the end of loop, required with do
. exit - commands exit from loop
. ===========================================================================================================  BOOLEAN BLOCKS
. if - starts one and is followed by Boolean expression to evaluate
. else - optional, marks line to goto if Boolean evaluates false
. fi - marks end of Boolean block

You write the code up in your favorite WYSIWYG editor and save it with a name ending in B.txt.
Drag and drop the file onto BRUN.exe to run it, Drag and drop on Brun debug.exe to watch variables as progress through program lines.

Here is example program that solves (using an array, see get and put lines) the coconut problem found at JB forum presented by bluatrigro that does use an array:
Code: [Select]
' and 1 for the monkey problem B.txt adopted for BRUN v2 to test string new string array functions get and put
' and 1 for the monkey problem.bas for JB 2.0 b 2018-02-11

n start 100
.   i (bluatigro) fount this puzle in a book:
.     there are 5 person's + 1 monkey
.     they shipwrek on a Island
.     the fisrst day they colect kokonut's
.
. day 1:"
. I (bplus) am starting with a number of coconuts.
n cc start
dim pile(5) this is why we need string array! for 5 piles
. Say the coconuts collected by the people is start .
.
.     in the night happens this:
.     (each) person goes to the pile
.     divides it in 5 hides 1/5
.     and gives 1 to the monkey
.
. I (bplus) am paying the monkey first.
. I (bplus) am not cutting any coconuts into parts of coconuts.
.
. So Coconut inventory after first night:
do
n persn persn + 1
if persn > 5
exit
fi
n cc cc - 1
n monk monk + 1
put piel persn int(cc/5)
n cc cc - int(cc/5)
get p piel persn
. For person persn , their pile is p
loop
.             and monkey has monk
.
. day 2"
.      the 2e day"
.      thay divide the remaining pile in 5"
.      and give 1 to the monkey"
.      now calc the size of every pile"
.
. Coconuts starting day 2, before final divvy is cc
n cc cc - 1
n monk monk + 1     
n divee int(cc/5)
. After monkey gets one more coconut the divvy is divee
.
n persn 1
do
get p piel persn
n p p + divee
put piel persn p
n persn persn +1
if persn > 5
exit
fi
loop
n Remain start
n persn 1
do
get p piel persn
. For person persn , their pile is p
n Remain Remain - p
n persn persn + 1
if persn > 5
exit
fi
loop
. The monkey has monk coconuts.
n Remain Remain - monk
.
. Coconuts remaining are Remain for the monkey who programmed this inventory.


Unlike Nano* written in 100 lines that needed SmallBASIC to Interpret, BRUN is a stand alone exe written in QB64.

PS Oh it looks like I used INT and DIM also, sorry it's been months since I looked at this.

Confirm I do have an INT function, BTW everything command wise is lower case.
Ha! I do not have DIM because IT IS NOT REQUIRED! how nice for beginners, eh?

BRUN ignores everything in a line that does not start with a keyword command, thus no crash for DIM line.
And the ' for comments is completely optional.
I am using a space as the only delimiter between parameters, so no string processing in this baby.
Don't bother formating with multiple spaces either because printed lines are stripped of extra spaces.
Use rc for row, col locating for print = (.,;) or input =(?), also there is cp for center alignment of print job.
Characters are 8x16 for cell.

Nano was contest winner: http://retrogamecoding.org/board/index.php?topic=584.0
before I made it a standalone with arrays and regular variable names instead of 26 letters.
« Last Edit: September 14, 2018, 01:56:29 AM by B+ »

ScriptBasic

  • Guest
Re: Beginner friendly BASICs
« Reply #2 on: September 14, 2018, 05:02:41 AM »
Why would anyone buy a BASIC language when you can just write your own? There hundreds of examples of folks doing just that.

Today most BASIC's are like slot cars the authors place on to track when some performance pissing match (challenge) gets a post by one of them.

My interest in BASIC is glueware I use on a daily basis to integrate processes and reduce reentry of data.


ZXDunny

  • Guest
Re: Beginner friendly BASICs
« Reply #3 on: September 14, 2018, 09:12:34 AM »
Why would anyone buy a BASIC language when you can just write your own? There hundreds of examples of folks doing just that.

Being able to write one's own interpreter kinda precludes the need for BASIC, wouldn't you say?

B+

  • Guest
Re: Beginner friendly BASICs
« Reply #4 on: September 14, 2018, 11:21:08 AM »
I have revised my help file to 38 lines that include array stuff and this revision includes name revision from BRUN.exe to SB.exe for even shorter commands to type. SB is shorthand for Shorthand Basic. If beginners hate typing as much as I then this is the Basic for them!

Call this SB.exe  short for Shorthand Basic.
Quote
. 000 SB Help B.txt for SB.exe (B+=MGA) rev 2018-09-14 Drag and drop *B.txt file onto SB.exe to run it.
. (All lines here are print lines, drag and drop this file onto SB.exe to read it without dots.)
. To avoid punctuation, all executed lines start with keyword commands or punctuation as follows:
. ===========================================================================================================  VARIABLES
. Number variables are set st n is first letter on line, variable name is next, and variable expression last.
. Use up to 250 "words" for variable and expression including previous number variables, operators: +-*/^%()<=>
. constants: e, pi, rnd   trig functions (radians): cos(), sin(), tan(), atan(), conversion: rad(), deg()
. log(), exp(), operators using <, =, >, (and combinations) and, or, not need to be separated by spaces.
. example:  i = i + 1 becomes >>>>>   n i i+1
. angle = deg(atan(1.01) becomes >  n angle deg(atan(1.01))
. ===========================================================================================================  ARRAYS
. > arrayName index valueExpression - same as arrayName(index) = valueExpression  (No DIM statement needed)
. < var arrayName index - same as var = arrayName(index)
. ===========================================================================================================  OUTPUT
. For printing text:   . for print with line feed,     , for print and tab,      ; for print and stop
. l row col    - for locating next character cell for print or input place
. a x y text   - for locating with graphic x, y pixel positions
. c  - to clear clutter
. variables in print text will be replaced by their values, so be careful using variable names in print text.
. When there is more than one parameter be careful not to use a space in an expression for one of the parameters.
. =========================================================================================================== INPUT
. ? var prompt - syntax: ? is keyword, variable name, use 250 words for prompt.
. ===========================================================================================================  EXECUTION FLOW
. : lineLabel - sets line label in program
. g lineLabel - redirects flow to mark lineLabel ( do not enter or exit a sub with g )
. s subLabel - marks start of gosub routine
. gs subLabel - redirects flow to sub routine
. r - signals exit back to call point of sub routine
. w - will pause the given amount of seconds
. z - will end program
. ===========================================================================================================  LOOPING
. [ - marks start of loop
. ] - marks the end of loop, required with do
. x - commands exit from loop
. ===========================================================================================================  BOOLEAN BLOCKS
. i - starts one and is followed by Boolean expression to evaluate
. e - optional, marks line to goto if Boolean evaluates false
. f - marks finish of Boolean block

38 line manual, man beginners have got to love that!

Coming soon, a substitute for Read / Data: simply
var {data1 data2 data3...}

oh wait... let beginners substitute their own names in for these commands!
« Last Edit: September 14, 2018, 11:41:11 AM by B+ »

Aurel

  • Guest
Re: Beginner friendly BASICs
« Reply #5 on: September 14, 2018, 01:30:26 PM »
N
« Last Edit: September 23, 2018, 10:24:23 PM by Aurel »

B+

  • Guest
Re: Beginner friendly BASICs
« Reply #6 on: September 14, 2018, 02:20:36 PM »
Revision complete.

Look how easy it is to edit tabbed files in Notepad++ with the 000 Help SB.txt file right there and an Explorer Window to drag drop newly edited files onto SB.exe.

(notice I changed direction of < > signs)
« Last Edit: September 14, 2018, 02:29:35 PM by B+ »

B+

  • Guest
Re: Beginner friendly BASICs
« Reply #7 on: September 14, 2018, 02:40:44 PM »
Here is another sample test using Composites array and tabbed print:
Code: [Select]
simple sieve 2 SB.txt rev for SB.exe 2018-09-14 adopted from:
'Simple sieve 2.bas SmallBASIC 2015-04-29 found a faster sieve with BASIC 256
n topLimit 100
n limit topLimit ^ .5
. Primes to topLimit
take care of even numbers first
n index 4
[
> composites index 1
n index index + 2
i index > topLimit
x
f
]
now do odd numbers
n index 3
[
< test composites index
i test = 0
i index < limit
n j 2 * index
[
> composites j 1
n j j + index
i j > topLimit
x
f
]
f
f
n index index + 2
i index > limit
x
f
]
n index 2
pCount = 0
[
< test composites index
i test = 0
n pCount pCount + 1
, index
f
n index index +1
i index > topLimit
x
f
]
.
. There are pCount primes for the first topLimit integers.


Richly

  • Guest
Re: Beginner friendly BASICs
« Reply #8 on: September 15, 2018, 09:17:10 PM »
Personally, I have found retro BASICs (and their modern extensions), such as Sinclair BASIC / SpecBAS, BBC BASIC, Applesoft BASIC, etc. to be beginner friendly.

Other than these, of the more modern BASICs, my vote goes to Liberty BASIC; just because of the sheer number of resources and tutorials that are available - especially when you factor in those also available for Just BASIC and LB Booster that are largely compatible. Liberty BASIC also benefits from an active community that welcomes and encourages beginners, continued development and relative ease of use, especially GUI programming.

B+

  • Guest
Re: Beginner friendly BASICs
« Reply #9 on: September 16, 2018, 02:23:00 PM »
I think what we imagine beginner's need to get started depends allot on how we got hooked.

For me the jump from a hand calculator to a PC with only a BASIC using something like the 38 line manual I showed you would be the same distance jump going from doing math on paper to doing it with a calculator. Doing strings and primitive graphics would make the jump complete.

Dang! I am describing GW BASIC with Notepad++ for editor and no line numbers.


B+

  • Guest
Re: Beginner friendly BASICs
« Reply #10 on: September 16, 2018, 02:43:03 PM »
What I am saying is why buy an adding machine or even program a calculator when you have this!
Code: [Select]
[
? nextNumber Enter >
n sum sum + nextNumber
. ==================================================== + nextNumber = sum
]
« Last Edit: September 16, 2018, 02:50:53 PM by B+ »

B+

  • Guest
Re: Beginner friendly BASICs
« Reply #11 on: September 16, 2018, 03:16:33 PM »
I started adding string functions but the problem is I really love doing stuff without punctuation.

hmm... how can I have string without quotes?

load all string literals with special command.

hmm... what should we name that command?

How about $ in honor of old time BASIC.

hmm... now what string function should we test first?

How about a favorite from JB?

Code: [Select]
test some new string functions B+ 2018-09-15
$ months {January February March April May June July August September October November December} < this is new string literal recorder
l 2*5 10/10  <I am just testing locate l here 10th row 1st column
[
'c  < clear screen commented out
? nMonth Enter month number to name >
i nMonth > 0 and nMonth < 13
sf xmonth word months nMonth  < sf stands for string function, xmonth is var to load word returns the nth word in string
opps can't comment next lines because they are printing a formatted line
; The nMonth                 
; th Month of a year is xmonth
next line adds period to end of formatted print line
. .
e
x
f
]

BTW the above method also takes the place of READ / DATA by using strings as arrays.
Now you can access your data items in any order as needed.
« Last Edit: September 16, 2018, 03:32:25 PM by B+ »

ScriptBasic

  • Guest
Re: Beginner friendly BASICs
« Reply #12 on: September 16, 2018, 06:47:07 PM »
Welcome to the BASIC Frankenstein group. Looking forward to see your creation come alive.
« Last Edit: September 16, 2018, 06:49:17 PM by John »

Richly

  • Guest
Re: Beginner friendly BASICs
« Reply #13 on: September 16, 2018, 10:14:34 PM »
Hi B+

Is your language inspired by what Menn (Bestof) was trying to achieve with Fig?

At first sight, I find the omissions a bit confusing; sparsity and brevity does not always equal readability.

However, I must confess that I haven't studied it closely or tried it out yet.

It's certainly an interesting experiment.

ZXDunny

  • Guest
Re: Beginner friendly BASICs
« Reply #14 on: September 17, 2018, 12:00:07 PM »
I order to really take it to the upper echelons of Frankenstein-ism, you should also allow it to link to and run code in languages and APIs that are not BASIC in any way, shape or form!