Why nuBASIC

From my early days writing BASIC programs on a Commodore 64, I've always been drawn to the idea of developing a BASIC interpreter. This ambition materialized in 2014 when, during a C++11 programming course I was teaching, I decided to tackle the challenge of creating an interpreter as a comprehensive coding exercise. My choice of BASIC was inspired by its 50th anniversary, originally crafted by John G. Kemeny and Thomas E. Kurtz. Despite Dijkstra's critical view of BASIC, I've always believed in its simplicity and accessibility, especially for beginners and young learners. 

The Prefix "nu" in nuBASIC.

The "nu" prefix, often mistaken for "new," actually stems from a namespace I frequently use in my coding. While it has a different meaning in that context, it fit well for this project and had a catchy ring to it.

Evolution Strategy for nuBASIC.

While nuBASIC currently lacks some features I'd like to add, my goal is to enhance its existing capabilities, keeping its simplicity and portability intact. I aim to preserve nuBASIC's user-friendly and compact nature.

As a hobby project without financial gain, I can't predict when I'll next update nuBASIC, but I remain committed to its ongoing improvement.

Why nuBASIC is a Console Application.

Operating as a console application, nuBASIC offers a straightforward environment for learning and experimenting with language features. This simplicity, free from the complexities of a graphical interface, allows direct program input and execution. However, for those preferring a GUI, a graphical IDE is also available for Linux and Windows.

Console Window for Graphics.

Using the console window or X-terminal for graphics is admittedly unconventional. While this method has limitations, it allows for simple graphic applications. I hope to eventually expand nuBASIC to support full GUI functionality.

Compatibility with Other BASIC Dialects.

nuBASIC is partially compatible with dialects like GW-BASIC and QBASIC. It supports both classic line-number based programs and modern structured programming paradigms. As an example, nuBASIC successfully runs two implementations of the Rosetta Code Mandelbrot set example:

Implementation 1

5  Rem Rosetta.bas

10 For x0 = -2 To 2 Step .01

20 For y0 = -1.5 To 1.5 Step .01

30 x = 0

40 y = 0

50 iteration = 0

60 maxIteration = 223

70 xtemp = x*x-y*y+x0

80 y = 2*x*y+y0

90 x = xtemp

100 iteration = iteration + 1

110 If ((x*x+y*y<=4) And (iteration < maxIteration)) Then GoTo 70

120 If iteration <> maxIteration Then c = iteration Else c = 0

130 d%=150: dx%=300 : dy%=300

140 FillRect x0*d%+dx%,y0*d%+dy%,x0*d%+dx%+2,y0*d%+dy%+2,int(c)*16

150 Next y0

160 Next x0

Implementation 2

' Rosetta.bas

For x0 = -2 To 2 Step .01

   For y0 = -1.5 To 1.5 Step .01

      x = 0

      y = 0

      iteration = 0

      maxIteration = 223

      While ((x*x+y*y<=4) And (iteration < maxIteration)) 

         xtemp = x*x-y*y+x0

         y = 2*x*y+y0

         x = xtemp

         iteration = iteration + 1

      End While

      If iteration <> maxIteration Then

         c = iteration 

      Else 

         c = 0

      End If

      d%=150 

      dx%=300

      dy%=300 

      FillRect x0*d%+dx%,y0*d%+dy%,x0*d%+dx%+2,y0*d%+dy%+2,int(c)*16

    Next y0

Next x0

Is nuBASIC Free?

Yes, nuBASIC is free and open source, distributed under the MIT license from version 1.48 onwards. Source code and binaries are available on SourceForge and GitHub.

Accessing nuBASIC Documentation.

You can find the latest nuBASIC documentation, including User Guides in PDF and ODT formats (in English and Italian), at nuBASIC Documentation on SourceForge.

Why C++11?

C++11, standardized in August 2011, brings several enhancements to the core language and the Standard Library. More about C++11 can be found at Stroustrup's C++11 FAQ.

Building nuBASIC

nuBASIC can be compiled on Windows, Linux, and MacOS. For Windows, a Visual Studio console application can be created, while Clang or gcc/g++ with C++11 support is used for other platforms.

Using nuBASIC

nuBASIC is user-friendly, including all necessary components for creating and running programs. It features a command line interpreter (CLI), a language interpreter, and an Integrated Development Environment (IDE) for Windows and Linux/GTK+2.

Support and Bug Reporting

For support or to report bugs, please email antonino.calderone@gmail.com. I'll respond as promptly as possible.

Acknowledgments

I extend my thanks to everyone who contributed to nuBASIC's development, especially Brian Decker for his bug discoveries and valuable language compatibility suggestions.