Slave Programming Language
Slave is a simple, compiled and multi-paradigm programming language. It is been coded in C++ and is syntatically influenced by Python. The syntax of this programming language is simple and it can be used to program in Malayalam language. The language also supports low level programming features such as pointers, betwise operations etc.
Characteristics
The SLAVE Programming language exhibits the following characteristics:
- There is a small, fixed number of keywords
- There are a large number of arithmetical and logical operators, such as +, +=, ++, &, ~, etc.
- Typing is static, all data has a type, but implicit conversions can be performed.
- Low-level access to computer memory is possible by converting machine addresses to typed pointers.
- Functions may not be defined within the lexical scope of other functions.
- A preprocessor performs macro definition, source code file inclusion, and conditional compilation.
- Programs can also be written in Malayalam language also.
- Malayalam keywords are introduced.
Paradigm Independent Programming
The SLAVE programing language developed to work independent of a particular paradigm. It is designed to work with any paradigm as the programmer wishes. It can currently work with sequential, procedural or a mixed style with procedural and sequential.
An example for sequential program in SLAVE:
# Program to add two numbers
print "Enter the first number: "
read num1
print "Enter the second number: "
read num2
sum=num1+num2
print "Sum: ",sum,endlA pure procedural program written in SLAVE:
# Program to read a name, purely procedural oriented
function readName()
{
print "Enter your name: "
readString (name,20)
}
function execute()
{
readName()
print "Entered Name: ",name,endl
}SLAVE supports mixed paradigm. A program can be written in sequential, procedural or a mixture of these two. A program that uses functions along with sequential code is given below.
# Swap two numbers
function readNum()
{
print "Enter two numbers: "
read num1,num2
}
readNum()
# function call
print "Before Swapping:\nnum1: ",num1,"\nnum2: "num2,endl
temp=num1
num1=num2
num2=temp
print "After swapping: \nnum1: ",num1,"\nnum2: "num2,endl