Click here to Skip to main content
Click here to Skip to main content

Tagged as

Supernova Programming Language

, 12 Apr 2010 CPOL
Rate this:
Please Sign up or sign in to vote.
Supernova is a modern scripting language for Microsoft-Windows released as Freeware

Introduction

I am interested in Compiler implementation using AI Techniques and Supernova (Simple scripting language for Microsoft-Windows which released formally as Freeware) as a result of my research on this topic.

Supernova is a small size programming language (less than 15MByte) and you can use it for quick and simple tasks. It is also useful for children as a start towards learning the art of programming.

Supernova as a language tends to be more near to our human language where we do Programming With Fiction Description (PWFD) using subset of Pure human language.

The human language is VERY big and contains many words so we use a subset of it to **Reduce the Complexity** of the problem and to **Get Acceptable Performance** as much as we can.

Unlike other programming languages which is based on statements, Supernova is based on paragraphs which contain many statements packed together using ignored words like (the, and,...etc.).

For example, the two commands:

  • I want window
  • Window title is hello

May be connected together to form another big statement:

I want window and the window title is hello.

And a collection of big statements form a paragraph and a collection of paragraphs form a program.

Unlike other programming languages, most of Supernova programming language statements have a rule describe its structure and help users to use and remember the statement in the future.

For example:

The rule: PVC used to control the structure of the Statement I Want Window

  • Rule: PVC = Pronoun Verb Class
  • Statement = I Want Window follow PVC Rule
  • Where:- [I] = Pronoun , [Want] = Verb and [Window] = Class

Using the Code

I have 5 samples to show.

The sample files take the extension .Nova.

To run these files, you need the Supernova Interpreter Nova.exe except the delivery sample.

It's attached as source code + executable file ready to RUN!! (i.e. using Supernova, you can distribute your applications as executable files. This feature added starting from version 1.1 which released in 2010.03.30).

The language interpreter released as FREEWARE product for Microsoft-Windows and can be downloaded from http://sourceforge.net/projects/supernova/files.

  1. Flash.nova Sample:

    p1.JPG

    I want window and window title = Hello!!.
    Window back color = {5,155,255}.
    Window width = 330.  window height = 250.
    Window name = win1.
    
    I want button and button caption = Be my friend , click to say yes !!.
    The button top = 20. button width = 300.
    The button name = btn1.
    
    I want button the button top = 80.
    Button caption = . and the button name = btn2.
    
    I want button the button top = 130.
    Button caption = . and the button name = btn3.
    
    btn1 mouseclick. instructions are
        Btn2. button selected and button caption = Really !! ? .
    End of instructions
    
    btn2 mouseclick. instructions are
    Do while (True).
        Btn3. button selected and button caption = Hurrah.
        [x]. = the seconds. and do while "the seconds - [x] < (0.5)"
                        Do windows events
                    End while
        Btn3. button selected and button caption = .
        [x]. = the seconds. and do while "the seconds - [x] < (0.5)"
                        Do windows events
                    End while
    End while
    End of instructions
    
    btn3 mouseclick. instructions are
        You close window
    End of instructions
            €
  2. TheClock.nova Sample

    p4.JPG

    Application title = The Time.
    
    I want window and window title = The Time.
    window back color = {5,155,255}.
    window width = 330.  window height = 250.
    window name = win1.
    
    I want label
    The label font size = 40. and label width = 300.
    label height = 100.
    
    I want button and button caption = Close.
    the button name is btn1.
    button top = 150. and button left = 150.
    
    do while (True).
        label caption from (   ) the time.
        [x]. = the seconds. and do while the seconds - [x] < (1).
                        do windows events
                    end while
    end while
    
    btn1 mouseclick. instructions are
        You close application
    end of instructions     
  3. Delivery2.nova

    delivery.jpg

    The application title is "Delivery2"
    Set window auto show off
    Set window resize off
    
    [myarray]. = (3).
    [myarray]\(1). = (Tea).
    [myarray]\(2). = (Cafe).
    [myarray]\(3). = (Sandwich).
    
    I want window and the window title is "Delivery"
    Window width = 730. and window height = 530.
    
    I want label
    The label width is 700. and label height is 120.
    The label font size is 20.
    The label back color = white.
    The label caption is
    "
    	What do you want ?
    "
    
    I want label and label top is 140.
    label caption is Title :.
    label font name is "arial"
    label font size is "14"
    
    I want textbox
    textbox left is 80.
    textbox top is 140.
    textbox width is 500.
    textbox font name is arial.
    textbox font size is 14.
    textbox name is text1.
    
    I want listbox and listbox top is 180.
    Listbox width is 700. and listbox height is 250.
    The listbox font name is arial.
    The listbox font size is 14.
    
    [x]. = (1). and do while [x] <= [myarray].
    The listbox must add from [myarray]\[x].
    [x]. = [x] + (1).
    end while
    
    I want button and the button top is 450.
    The button left is 240. and button caption = "Ok"
    The button name is btn1.
    The button back color is white.
    
    I want button and the button top is 450.
    The button left is 360. and button caption = "Close"
    The button name is btnclose.
    The button fore color is white.
    The button back color is red.
    btnclose mouseclick. instructions are you close application ok
    
    listbox value is 1.
    
    You centre window and You show window
    
    btn1 mouseclick. instructions are
    	The listbox value to [x].
    	do if not [x] == (0).
    		"(
    			Delivery Application
    -------------------------------------------------------------------
    Date  :) thedate  (
    Time  :) thetime  (
    Month :) themonth (
    Day   :) theday   (
    Item  :---------------> ) [myarray]\[x] (
    -------------------------------------------------------------------)"
    		memory to file "(delivery.txt)"
    		execute file "delivery.txt"
    	end if
    end of instructions
    
    text1 change. instructions are
    	textbox value to [mystr].
    	[mystr]. = lower [mystr].
    	[x]. = (1).
    	do while [x] <= [myarray].
    		[myitem]. = lower [myarray]\[x].
    		[check]. = [mystr] at [myitem].
    		do if not [check] == (0).
    			listbox value from [x].
    		end if
    		[x]. = [x] + (1).
    	end while
    end of instructions
  4. COM.nova

    shot146.JPG

    I want window and the window title is COM Test.
    I want button and button caption is Open Word Application. button width = 150.
    button name = btn1.
    I want button and button caption is Hide Word.
    button name = btn2. and button left = 200.
    I want button and button caption is Show Word.
    button name = btn3. and button left = 350.
    
    procedure btn1 mouse click.
    	[myobj]. COM Object to create of type "(Word.Application)"
    	[myobj]. COM Object to use
    	"(Documents:Add)" COM method to call with parameters nothing.
    	(visible). COM Property to set (1).
    endprocedure
    
    procedure btn2 mouse click.
    	[myobj]. COM Object to use and (visible). COM Property to set (0).
    endprocedure
    
    procedure btn3 mouse click.
    	[myobj]. COM Object to use and (visible). COM Property to set (1).
    endprocedure
  5. ADODB.nova

    SHOT148.JPG

    I want window contains LISTBOX and the window title is Using ADODB.
    Window width = 600.  and WINDOW HEIGHT = 500.
    Window back color is white.
    
    Listbox width = 350. and LISTBOX HEIGHT = 450.
    Listbox back color is silver.
    Listbox fore color is Black.
    Listbox font name is arial.
    Listbox font size is 14.
    
    I want button and button caption is Test ADODB.
    Button name = btn1. and button LEFT = 400. and button width = 150.
    
    procedure btn1 mouse click.
    
    	:Note: " Connect to the Database Test.MDB"
    	[MYCON]. COM OBJECT TO CREATE OF TYPE "(ADODB.Connection)"
    	[MYCON]. COM Object to use
    	[MYARRAY]. = (1).
    	[MYARRAY]\(1)\(1). = (string).
    	[MYARRAY]\(1)\(2). = '(Provider=MSDASQL.1;Persist Security Info=False;
    	  Extended Properties="dsn=MS Access Database;
    		uid=";Initial Catalog=test.mdb)'
    	"(OPEN)" COM method to call with parameters MYARRAY.
    
    	:Note: " Open Table MainTable"
    	[MYRS]. COM OBJECT TO CREATE OF TYPE "(ADODB.Recordset)"
    	[MYRS]. COM Object to use
    	(CursorType). COM Property to set (3).
    	(LockType). COM Property to set (3).
    	(ActiveConnection). COM Property to set [MYCON].
    	[MYARRAY]. = (1).
    	[MYARRAY]\(1)\(1). = (String).
    	[MYARRAY]\(1)\(2). = '(Select * from MainTable)'
    	"(OPEN)" COM method to call with parameters MYARRAY.
    
    	:Note: " Delete All Records"
    	'(RECORDCOUNT)' COM PROPERTY TO GET [MYMAX].
    	doif [mymax] > (0).
    		[X]. = (1).
    		DoWhile [x] <= [MYMAX].
    			"(movefirst)" COM method to call with parameters .
    			"(delete)" COM method to call with parameters .
    			"(update)" COM method to call with parameters .
    			[x]. = [x] + (1).
    		endwhile
    	endif
    
    	:Note: " Add 10 Records "
    	[X]. = (1).
    	DoWhile [x] <= (10).
    		"(AddNew)" com method to call with parameters .
    		'|fields:item("Number"):value|' COM PROPERTY TO SET [x].
    		'|fields:item("Square"):value|' COM PROPERTY TO SET [x] x [x].
    		"(UPDATE)" COM method to call with parameters .
    		[x]. = [x] + (1).
    	EndWhile
    
    	:Note: " Show All Records "
    	"(movefirst)" COM method to call with parameters .
    	'(RECORDCOUNT)' COM PROPERTY TO GET [MYMAX].
    	listbox must add item --------------------------.
    	listbox must add from (Records Count = ) [MYMAX].
    	listbox must add item --------------------------.
    	listbox must add item Number 		     Square.
    	listbox must add item --------------------------.
    	[X]. = (1).
    	DoWhile [x] <= [MYMAX].
    		'|fields:item("Number"):value|' COM PROPERTY TO GET [V1].
    		'|fields:item("Square"):value|' COM PROPERTY TO GET [V2].
    		Listbox must add from [v1] (                      ) [v2].
    		"(movenext)" COM method to call with parameters .
    		[x]. = [x] + (1).
    	EndWhile
    
    	:Note: " Close Recordset"
    	"(CLOSE)" COM method to call with parameters .
    
    	:Note: " Close Connection"
    	[MYCON]. COM Object to use and "(CLOSE)" COM method to call with parameters.
    
    endprocedure

Points of Interest

  1. Simple programming language for writing simple Microsoft Windows applications
  2. A programming language near to our Human-Language
  3. Multi-Language source code support including English & Arabic as a start
  4. Not Case/Space/Tab/Line Sensitive

History

I am the creator of Supernova (simple scripting language for Microsoft-Windows) and I am interested in Compiler implementation using AI-Techniques and Supernova is a result of my researches in this topic and I released it as freeware in 2010.03.19 so children from different countries can use it as a simple start towards programming.

Have fun!

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

No Biography provided

Comments and Discussions

 
GeneralCongratulations PinmemberAndre Luiz Alves Moraes29-Mar-10 4:40 
GeneralRe: Congratulations PinmemberMahmoud Fayed30-Mar-10 1:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.1411019.1 | Last Updated 13 Apr 2010
Article Copyright 2010 by Mahmoud Samir Fayed
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid