Supernova (programming language)

Supernova is a free open source NATURAL programming language primary used for creating portable GUI applications for Microsoft Windows and GNU Linux. The language uses Qt for the user interface and it's written in Harbour.

Supernova allows writing programs in a syntax very close to the real language, people can use their own verbal language, Supernova doesn't require learning English to write the code.

Examples

Hello World

Classic Hello world example

I want window and the window title is Hello World.

Events example

I want window contains button and the window title is Wikipedia.
Button name is Btn1. and button caption is Click Me.
Procedure Btn1 mouse click.
    Button Caption is Welcome to Supernova.
    Button Width is 300.
End procedure 

Grammar

Supernova uses Context-Sensitive Grammar:

I want window and the window title is I want window.

In the previous example, The first "I want window" sentence is a command while the second is a literal Supernova determine if the sentence is a command or literal using a context sensitve grammar

Nested procedures, Tests and Counter objects

Supernova follow the design principle of "more than one way to do things" like Perl and Ruby The if-statement could be written as in imperative languages (but more verbose) or replaced by test conditions. The loops could be normal while loops or replaces by counter objects The next example shows the programs structure in the language

:note: "application settings"
set window auto show off
set label transparent on
The application title is "Dynamic Objects"

:note: "application window"
I want window and the window title is "Dynamic Objects"
window width = 450. and window height = 500.
the window back color = {255,255,255}.

:note: "window controls"
i want label and label caption is "Enter Number"
i want textbox and textbox left is 100. and the textbox name is text1.
i want button and button caption is "Create"
the button left is 320. and the button name is btn1.

:note: "application task"
btn1 mouseclick. instructions are
        text1. textbox selected and textbox value to [num1].
        i want counter 
        the counter start is 1.
        get the counter end from [num1].
        the counter step is 1.
        the counter name is mycount1.
        [theleft]. = (30). and you use counter 
        [theleft]. = (150). and you use counter 
        [theleft]. = (270). and you use counter 
        mycount1 change. instructions are
               counter value to [myvalue]. 
               [mytop]. = [myvalue] x (50).
               i want button
               the button caption from [myvalue].
               the button top from [mytop].
               the button left from [theleft].
               the button backcolor is {255,255,255}.
               the button name is dynamicbutton.
               dynamicbutton mouseclick. instructions are
                       the button backcolor is {255,255,0}.
               end of instructions
        end of instructions
end of instructions

You Show Window

from the previous example we see that variables are written between bracts as [variable name] while values (numbers/strings) are written as (value) and both of variables/values when written are expressions that must end by dot.

Supernova uses Dynamic typing where the variable have no type, but the values are And it's weakly typed language that do automatic conversions of types based on usage.

Problems

Verbose

The problem with Supernova code is that it's extremely verbose where the same code could be written more shorter in other programming languages like C#

for example, the next program in supernova could be rewritten more shorter in C#

i want window and the window title is Hello World.
i want button and button caption is Close.
and button name is btn1.

btn1 mouse click. instructions are
   you close window
end of instructions

The C# Example:

var myWindow = new Window( title="Hello World" );
myWindow.addButton( new Button( caption="Close", name="btn1" ) );
btn1.onMouseClick = function() {
    myWindow.close();
}

Obfuscated code

Another problem with the language, it allows writing obfuscated code The language is not Case, Space, Line and/or Tab sensitive event at the same keyword level. Inside Supernova parser, The token is a letter and the next program is a valid program

i 
w a n t w i n
d o w a n d t
hewindowtitleishello world.

Performance

Supernova is slow due to language design decisions (Dynamic typing, Weakly typed, context-sensitive and the token is a letter) and implementation architecture (The Supernova virtual machine runs on the top of the Harbour virtual machine).