Popular Posts

Saturday, October 4, 2014

55 Years of History: BASIC Interpreters vs. BASIC Compilers

By design, BASIC interpreters are slow and generally not intended for anything more than introductory programming classes.  In stark contrast, high-end BASIC compilers, such as cyBOSS, are suitable for a wide-range of uses, including: custom business software, marketable canned application software, and industrial robotic software.  The remainder of this article discusses, in-depth, the 55 year history of the BASIC computer programming language.


The rise of BASIC programming popularity 

Commencing with the dawn of the personal computer era, (around 1978), BASIC grew into a very popular programming language among students, hobbyists, and enthusiasts.  Primarily because the BASIC language was easy-to-learn and fun-to-use. But, also because it came packaged with nearly all the affordable personal computers during the 1980s.

Unfortunately, these popular computer systems came with poorly performing BASIC interpreters. As young programming students entered the professional workforce they began shunning BASIC due to its lack of power. However a few die-hard professionals remained loyal to 'classic' BASIC syntax and created their own BASIC compilers which often delivered more power than COBOL, FORTRAN, and other high-level languages.  The tech shakeout of the early 1990s, forced most computer hardware companies out-of-business leaving just Apple and IBM architecture standing in the personal computer market. Thus, this shakeout cause many BASIC compiler implementations to go the way of the dinosaur when the hardware platforms they were designed to operate on were no longer being manufactured and sold.



Interpreters vs. Compilers
(An In-Depth Technical Analysis)

A computer's CPU can only execute instructions written in machine code.  The below book titled, "Programming the 8086/ 8088" by James W. Coffron is ISBN #0-89588-120-9, copyright 1983.

This book contains a list of all the machine code (Assembly Language) for the Intel CPU 8086 chip, and 8088 chip.  [Note: These are the CPU chip used in the original IBM PC line.  As Intel upgraded these CPUs into the x286, and x386 chips; by necessity Intel made upgrades downward compatible meaning that the newer chips would execute machine code written for the 8086/8088 base.] 



Below is a picture of page 264 of this book, which contains a list of programming languages showing the relative power of various languages. Remember, this book was published in 1983, back when CPUs ran at speeds in the low megahertz; compared to modern-day CPUs which run in the gigahertz, thousands of times faster.  Therefore, the 'POWER OF THE LANGUAGE' chart which lists BASIC at the bottom of the HIGH-LEVEL languages, did so because during this era BASIC compilers were not yet in wide spread use.  And, compiled language implementations are far more powerful than interpreted language implementations; for reasons covered below.
   



What is an Interpreted Language?

Since a computer's CPU can only execute machine code, program instructions written in other languages must be translated into machine code.  Generally, a BASIC interpreter reads and translates instructions line-by-line.  After each line is translated, the resulting machine code is executed.  As a result of wasting CPU time on this continuous and unending translation, all interpreted languages have very lackluster performance compared to compiled languages.

The above 8086 Assembly code gets 'assembled' into the hexadecimal machine code shown to the left of the line numbers. For example: On line #1869, the assembly instruction 'CLI' which stands for Clear Interrupt Enable Flag gets assembled into a single byte of hexdata '0xFA'; and this byte is assembled into the code segment at offset 0xE85A.   [Note: The above picture is from page A-26 of the IBM Technical Reference Manual #6025005 (revised April, 1983). 

Most of the 'classic' BASIC languages used by millions of people during the 20th century were implementations of BASIC interpreters; including: AppleSoft BASIC, Radio Shack's TRS-80 BASIC, Microsoft's BASICA [for IBM-PC] and GW-BASIC [for IBM PC clones], Commodore 64 BASIC, Atari BASIC, and Texas Instruments TI-BASIC.

If that wasn't bad enough, all of these interpreted BASIC languages were further weaken as a result of the following conditions: (i) they executed on very weak hardware systems [by modern-day standards], (ii) they had relatively few commands and functions, and (iii) they simply were not designed or intended to be used for serious application development.  As a result, these 'classic' BASIC languages were shunned by professional programmers casting an unjust stigma on BASIC in general.



What is a Compiled Language?

A compiler translates the entire program into a separate file, known as an object file.   This object file can either be machine code or P-code.  Machine code is directly executable by the CPU; whereas P-code is an intermediate binary language which is executed by a runtime program.

Complied languages offer superior performance over interpreted languages; because they don't waste time on the translation during a program's execution.

Microsoft's QuickBASIC was very popular during the 20th century because it offered a leap in raw performance over nearly all other BASIC languages of the day.



What is the best compiled BASIC available today?

Google the words, "BASIC programming language" and you'll be bombarded with several BASIC implementations to choose from.  However, wisdom dictates steering clear of all products that lack well written and fully documented technical reference manuals.  You don't want to be the unfortunate programmer who invests hundreds to thousands of hours working on a new application program-- only to get stumped with a glitch that you can't fix do to poor compiler documentation.

Unfortunately, because most BASIC implementations are buggy and poorly documented, there are very few quality products remaining on the table to pick from. The best 'classic' BASIC compiler available for the Windows operating system is the cyBOSS language.  It works on Windows XP, Windows Vista, Windows 7, and Windows 8.1  (although it works best on Windows XP and 7) . 

The cyBOSS compiler is embedded into the cyBOSS Runtime Platform, published by GSPH, LLC, d/b/a cyBOSS platforms.  It contains a very well written and in-depth technical reference manual. The cyBOSS Application Developer indexes all 1300+ commands and functions and displays pages of the manual at the click of a mouse.   For more info, visit: www.cyboss.org

3 comments:

  1. BASIC is making a comeback!

    ReplyDelete
  2. Interpretation vs. compilation doesn't make as much of a difference these days as it did back in the 70s and 80s when CPU speeds were measured in MHz. Nowadays, even as far back as the early 2000s games were handing off logic control to interpreted scripting languages rather than being compiled - the benefits were portability and ease of maintenance for obvious reasons. These days, only the main structure of the game engine is compiled, the rest is scripted with things like Lua. You'd certainly not want to write a 3D engine in BASIC!

    ReplyDelete
    Replies
    1. Very true! A "core" language engine of any nature should be written in something that assembles into machine code for the target CPU.

      However you should be mindful of the fact that there are two different types of "core" language engines, as follows:

      > Compiled Pueso-code Languages (CPL) engines. [cyBOSS (2014 langauge), QuickBASIC (1988 language)]

      > Interpreted Scripting Lanague (ISL) engines. [Python, HTML, CSS, and other scripting languages]


      When choosing a HIGH-LEVEL language to develop custom business and industrial software, CPL engines offer significant security advantages over ISL engines, because they use a secondary compiler to convert HUMAN-READABLE scripts (known as "source code") into encrypted MACHINE-CODE like P-code.

      Therefore, the distributed executables which drive CPL engines are by their very nature highly resistant to: hacking, data corruption, and industrial espionage.


      Note: Microsoft's QuickBASIC last released in 1988 used a CPL engine (a/k/a Runtime System) which executed non-encrypted P-code files.
      The cyBOSS language released in 2014 uses a CPL engine which executes both encrypted and non-encrypted P-code files. And, to create an encrypted P-code file, the programmer need only use the #SECURITY# meta-command to specify a 48 byte custom encryption key.

      Delete