nuBASIC‎ > ‎


Why nuBASIC?

Ever since starting writing BASIC programs on my Commodore 64 I've always wanted to write a BASIC interpreter.

During a programming course in C++11 which I held in 2014, I decided to implement an interpreter, as sample code, and my choice fell on BASIC, fifty years after John G. Kemeny and Thomas E. Kurtz designed the original BASIC language.

Despite Dijkstra's famous judgment, "It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration", BASIC was one of the few languages simple enough for a 8 year old child to understand, so its simplicity made it easy for beginners to learn programming.
I was 8 years old when I started programming in BASIC and I'm not sure that I was able to understand so well advanced programming languages in those days. 

What does the prefix “nu” mean?
The prefix "nu" does not mean "new", but it comes from a namespace that I often use in the source code, with different meaning, but it sounded good enough to be used.

What is the evolution strategy for the language?

nuBASIC lacks many features I would like to add. Also I would like to improve existing ones, but maintaining the current level of simplicity of the language and portability of the interpreter, because I want to keep nuBASIC as small and intuitive as possible.
I cannot say when I'll have time to improve it, this for me is an almost ludic activity, and I am not getting paid for it. However, I will try to do as I have done to date.

Why nuBASIC runs as console application ?

Console application performs all their input and output at the command line, and it is ideal for quickly trying out language features and it greatly simplifies the learning process by removing the complexity of a graphical user interface.
Moreover, the interpreter provides you a traditional BASIC command line interface where you can enter programs directly and execute them, although you can also use an IDE (right now available for Windows platform only) or an external text editor to write your program before passing it to the interpreter.
The console window (or the X-terminal in Linux) is also used to draw graphics. 
This is an unusual choice, but again, this approach allows of writing simple application that needs to use graphics, although it has several drawbacks, including not optimal control of window repainting. I am planning to extend nuBASIC in order to support GUI paradigm, introducing event driven programming, but keeping also the simple support for console inline graphics.

Is nuBASIC compatible with other BASIC dialects?
nuBASIC is partially compatible with GW-BASIC, QBASIC and maybe others.
It also allows you to write both classic BASIC programs, which use line numbers and GoTo or GoSub control structures, and procedure oriented programs, based on structured and procedural programming paradigm.
The following two implementations of Rosetta Code example (the Rosetta stone of Fractal geometry is the Mandelbrot set) run correctly on nuBASIC interpreter:

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 
         c = 0
      End If


      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?

nuBASIC is free, open source and distributed under GPLv2 License
You can download source code and binaries from either SourceForge or GitHub.

How do I get documentation on nuBASIC ?

The standard documentation for the current stable version of nuBASIC is available at nuBASIC Reference session of this web site. 
PDF and ODT Guides are also available at

What is C++11?

It is a version of the standard of the C++ programming language approved by ISO on 12 August 2011.
C++11 includes several additions to the core language and extends the C++ Standard Library.
If you are interested in more information on C++11, please read this 

How to build it?

nuBASIC source has been written in C++11 and compiles under several operating systems including Windows and Linux. 
To compile nuBASIC you may create a Visual Studio console application or build it by using GCC >= 4.8.1 (both VS project files and autoconf/automake source files have been provided) or using MinGW >= 4.8.1.

How to use it?

nuBASIC can be used by any user without any additional programs. 

It has the components needed to create programs, including: 

The nuBASIC programming language can be divided into two components:

  • The language of nuBASIC, which defines the elementary linguistic constructs, for example, for variable declarations and loops.
  • The built-in function library which provides standard functions for example, functions for modifying numbers and strings, and files.

How to obtain support or submit bug reports?

Send an email to and I will answer you as soon as possible.