Computer software is such a mainstream part of our culture, that it’s not unlikely to at least have heard of Visual Basic, or VB as it’s often called. VB is a popular programming language from Microsoft. Visual Basic, as its name implies, traces its roots back to the original BASIC programming language created at Dartmouth College in 1964.[1] While possibly the most popular collection of dialects of the BASIC language, VB is but a small minority in terms of dialect count. How many dialects of BASIC are there? Dozens? Hundreds?
Out of curiosity, I wanted to get at least a ballpark figure for how many BASIC dialects there have been. It would be very convenient if someone has already compiled such a list. Fortunately, a fairly comprehensive list can be found on Wikipedia at https://en.wikipedia.org/wiki/List_of_BASIC_dialects.[2] How can this list be easily counted? While scripting would work, it can probably done manually with less time and effort.
It certainly would be useful to get just the dialect names. The list on Wikipedia is formatted so that the dialect descriptions are indented under their names. First I copied and pasted all the text of the web page into a text editor. Then I removed the text before and after the list and saved the result as a text file. The indents in the file were 4 spaces each, though I don’t know if they originally were tab characters. Either way, the “white space” worked to my advantage. In a command shell, I used the grep command to find all lines not starting with white space, which removed the descriptions as well as any blank lines. I piped the output into the wc command, which counts lines, words, and bytes.
>grep "^\S" "List2.txt" | wc 370 640 4376
The first number returned is the line count, but that also includes the section headers. In the original list in the web page, there was a section for each letter of the alphabet as well as one for the digits 0-9. Subtracting 27 header lines from 370 gives a count of 343 dialects. I’m assuming this is not completely accurate, but it’s close enough. Who would have thought that a single programming language could give rise to over 300 variations?
Note that I had previously found the dialect count by not resorting to the command line. I had converted the initial 4 space characters in each description to a tab character, so that I could filter out the descriptions in LibreOffice Calc. Then I subtracted the header count from the nonblank line count like I did above. However, when trying to paste text into Calc while writing this blog entry, somehow I only got a count of 160 lines. Something similar happened when trying to import the dialect list from a text file. Not wanting to spend too much time debugging the process, I tried the command line, and the result came fairly easily. So it pays to know more than one way to do things.
References
[1] https://en.wikipedia.org/wiki/BASIC
[2] https://en.wikipedia.org/wiki/List_of_BASIC_dialects
(c) Copyright 2020 by Mike Ferrell