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 non-trivial coding example, 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 kid to understand, so its simplicity made it easy for beginners to learn programming.
I was 8 year-old kid when I started coding in BASIC and I'm not sure I could understand more 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 a different meaning, but it sounded good enough to be used here.
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 one is an almost ludic activity for me, and BTW I am not getting paid for it! However, I will try to do it as I have done so far.
Why nuBASIC runs as console application ?
Console application is ideal for quickly trying out language features and it greatly simplifies the learning process by removing the complexity of a graphical user interface, providing the user with a traditional BASIC command line interface where he can enter programs directly and execute them. Nevertheless a graphical IDE (for Linux and Windows) is also provided.
Why the console window (or the X-terminal in Linux) is also used to draw graphics?
I have to admit 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 wish I had some time to extend nuBASIC to support full GUI paradigm, introducing also event driven programming.
But who was used to 80s BASIC interpreters still likes such approach (I guess), especially considering the nature of nuBASIC and its educational main purpose.
Is nuBASIC compatible with other BASIC dialects?
nuBASIC is partially compatible with GW-BASIC, QBASIC and maybe other BASICs.
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:
Is nuBASIC free?
nuBASIC is free, open source and distributed under MIT license since version 1.48.
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.
User Guides (in both PDF and ODT formats, in English and Italian) are also available at https://sourceforge.net/projects/nubasic/files/documentation/
Why C++11, and what is C++11?
C++11 is a version of the standard of the C++ programming language approved by ISO on 12 August 2011.
It 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
I was teaching C++ programming courses and needed to implement a non-trivial example in C++11.
I just started writing such interpreter and then have continued in my spare time to improve it, ever since (the version presented in the course was really trivial compared the current one).
nuBASIC compiles under several operating systems including Windows, Linux and MacOS.
To compile nuBASIC you may create a Visual Studio console application (Windows only) or build it by using Clang or gcc/g++ (you need a version which supports C++11).
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 command line interpreter (CLI), which provides an inline-editor for creating and testing programs.
The language interpreter, which is needed to run nuBASIC programs.
A Integrated Development Environment (IDE) for Windows and Linux/GTK+2 platform.
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 me, firstname.lastname@example.org and I will answer you as soon as possible.
Thank all the people who helped me to improve nuBASIC providing feedbacks, ideas, suggestions.
Special Thanks to Brian Decker for his help on discovering bugs and his nice suggestions on how to make the language compatible with ECMA-55.
Thank you all!