delta programming language

programmed and designed by Damon Swayn

this software is licensed under the BSD license

Copyright (c) 2011, Damon Swayn
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the aforementioned copyright holder nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL Damon Swayn BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

delta is written in the C# programming language and as such is a high level .NET language.

syntax:

delta follows a very simple syntax ruleset.

each line must end with a ';', comments belong on their own line and are marked with a '//'.

delta uses FLEE (Fast Lightweight Expression Evaluator) for evaluating boolean and mathematical
expressions.

standard rules such as print(), get() and even var() all look much like a function that would exist
within C/C++/C# etc, and as such, the standard language constructs are as follows:

print(string literal|variable) - prints onto the output stream. NOTE: no " characters need to surround
a string literal, variables are marked with a $ in front.

get(variable name) - gets all input from the input stream until the return key is pressed and stores
the input in the specified variable

var(variable name, value) - creates a variable of the specified name containing the specified value

if(boolean expression) - if boolean expression is true perform the appropriate block of code, otherwise
skip to the next block, a block is defined as a section of code starting with a line '{' and ending
with a line '}'

while(boolean expression) - same as if, but block will repeat while boolean expression is true

inc/dec(variable name) - increments or decrements an integer or floating point variable by 1, useful for while loops.

operators are as follows

the equals to boolean comparison operator is =
the not equals to boolean comparison operator is <>
the logical boolean operators are AND/OR/XOR
the arithmatic operators are +,-,/,*,^,% which are addition, subtraction, division, multiplication, to the power of and modulo respectively

to assign a variable to a value (lets say our variable is called foo) we say:

var(foo,5);
foo = foo * 5;
print($foo);

output: 25

NOTE: in delta variables can be re-assigned to different types, however, due to the typing system the compiler will use the most logical type first eg - by entering a number, the compiler will automatically call it an integer/float not a string.

Last edited Jan 10, 2012 at 4:44 AM by dswayn, version 1

Comments

No comments yet.