Академический Документы
Профессиональный Документы
Культура Документы
Project
On
Designing own imperative programming language
Submitted to - Prof.Prasad
DECLARATION
I hereby declare that the project entitled “DND” submitted for the completion of course,
Principles of Programming Languages (CSE-214), is our original work.
ACKNOWLEDGEMENTS
I wish to acknowledge my deep gratitude to the entire faculty of “Principles of programming
languages” for their cooperation throughout this project, in helping us to complete this project
successfully.
Our sincere appreciation to all our teammates who actually initiated this project and contributed
their efforts in completion of this project.
Some human errors may have inadvertently occur in this project despite our best efforts to keep
them out.
Abstract
In this project we are introducing 3 already existing programming languages with their scope and
motivation. Here next stop we are conducting a literature review where we are comparing these 3
programming languages in terms of datatypes, variables, operators,
Expression evaluation, looping statements, functions and parameter passing mechanisms after this we
are deriving the inferences on the literature review. After this process we are doing a requirements
specification where we are introducing 2 new datatypes and operators as part of our own language. The
main objective here is that while comparing the three languages we need to understand the differences
and the similarities along with their working by referencing this we need to design our own
programming language.
Next this we will be following this up with our own grammar for programming language along with test
cases and nay future scope and finally the conclusion.
Table of Contents
Title Page i
Declaration of the Student ii
Acknowledgement iii
Abstract iii
Data types Note: In Haskell, all datatypes start with a Capital letter, e.g.: Bool instead of bool.
Int, Integer, Float, Char, String, Bool, Double.
Variables For longer calculations and for writing Haskell programs, we want to keep track of intermediate results.
We can store intermediate results by assigning them names. These names are called variables. When a
program runs, each variable is substituted for the value to which it refers. For instance, consider the
following calculation
That is the approximate area of a circle with radius 5 , according to the formula
String concatenation ++
List concatenation ++
Note:
The not-equal operator in Haskell is /=, which is unlike most other languages which use! = for
the same purpose.
The Boolean negation operation in Haskell is not, which is unlike most other languages which
use! for the same purpose.
Expression
Haskell code will also work with parentheses, but we omit them as a convention. Haskell uses
evaluation
functions all the time, and whenever possible we want to minimize extra symbols.
(Precedence
and We still use parentheses for grouping expressions (any code that gives a value) that must be evaluated
association together. Note how the following expressions are parsed differently:
rules)
5*3+2 -- 15 + 2 = 17 (multiplication is done before addition)
5 * (3 + 2) -- 5 * 5 = 25 (thanks to the parentheses)
area 5 * 3 -- (area 5) * 3
area (5 * 3) -- area 15
Note that Haskell functions take precedence over all other operators such as + and *, in the same way
that, for instance, multiplication is done before addition in mathematic s.
Selection
The following flowchart shows the decision-making structure of Haskell −
statement
Looping In Haskell, there are no looping constructs. Instead, there are two alternatives: there are
statements
list iteration constructs (like fold which we've seen before), and tail recursion. ... But there are always
cases where you need to write something like a loop for yourself, and tail recursion is the way to do it
in Haskell.
Nested Loops in Haskell
For example, if I have this basic nested loop structure, how would I go about implementing this in
Haskell?
list = []
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
if board[i][j] == Nothing
list.append([i,j, 'X'])
}
}
return list
Functions play a major role in Haskell, as it is a functional programming language. Like other
Functions
languages, Haskell does have its own functional definition and declaration.
Function declaration consists of the function name and its argument list along with its output.
Function definition is where you actually define a function.
EX:
add :: Integer -> Integer -> Integer --function declaration
add x y = x + y --function definition
main = do
putStrLn "The addition of the two numbers is:"
print (add 2 5) --calling a function
The addition of the two numbers is:
7
val e1 = fn () => 1 * 0
val e2 = fn () => 1 div 0
var varA = 42
print(varA)
When we run the above program using playground, we get the following result −
42
Operators
Types of operators
2. Binary operator
3. Ternary Operators
This operator operates on three operands. Visit Swift Ternary Conditional Operator to learn more about
it.
1. Assignment operators
Operator Meaning
= Simple assignment operator, Assigns values from right side operands to left side operand
Add AND assignment operator, It adds right operand to the left operand and assigns the result
+= to left operand
Subtract AND assignment operator, It subtracts right operand from the left operand and assigns
-= the result to left operand
Multiply AND assignment operator, It multiplies right operand with the left operand and assigns
*= the result to left operand
Divide AND assignment operator, It divides left operand with the right operand and assigns the
/= result to left operand
Modulus AND assignment operator, It takes modulus using two operands and assigns the
%= result to left operand
Arithmetic operators
These operators are used to perform mathematical operations that includes multiplication,
division, addition and subtraction etc. This operators fall into category of binary operator that
takes two operands.
Operator Meaning
- Subtraction Operator
* Multiplication Operator
Operator Meaning
/ Division Operator
% Remainder Operator
Comparison Operators
These operators allow you to compare two values. Each of the comparison operators returns a Bool
value to indicate whether or not the statement is true. Swift supports following types of comparison
operators:
Logical Operators
These operators are used with Boolean (logical) values and returns a Boolean value. It is mainly used to
control program flow with if else, while, or some other control statement.
|| Logical-OR; true if either of the boolean expression is true false || true is evaluated to true
Operator Meaning Example
&& Logical-AND; true if all boolean expressions are true false && true is evaluated to false
Expression Operator precedence determines the grouping of terms in an expression. This affects how an expression is
evaluation evaluated. Certain operators have higher precedence than others; for example, the multiplication operator has
(Precedenc higher precedence than the addition operator.
e and
association For example, x = 7 + 3 * 2; here, x is assigned 13, not 20 because operator * has higher precedence than +, so it
first gets multiplied with 3*2 and then adds into 7.
rules)
Here, operators with the highest precedence appear at the top of the table, those with the lowest appear at the
bottom. Within an expression, higher precedence operators will be evaluated first.
Operator Description Example
Unary Operators +-
right-to-left
>> <<
< > <= >=
== !=
&
^
Binary Operators | left-to-right
&&
||
Comma , left-to-right
Selection Loop control statements change execution from its normal sequence. When execution leaves a scope, all
statement automatic objects that were created in that scope are destroyed.
Swift supports the following control statements.
1 continue statement
This statement tells a loop to stop what it is doing and start again at the
beginning of the next iteration through the loop.
2 break statement
Terminates the loop statement and transfers execution to the statement
immediately following the loop.
3 fallthrough statement
The fallthrough statement simulates the behavior of Swift 4 switch to C-
style switch.
Looping A loop statement allows us to execute a statement or group of statements multiple times.
statements Following is the general from of a loop statement in most of the programming languages −
Swift 4 programming language provides the following kinds of loop to handle looping
requirements
Functions
In Swift , a function is defined by the "func" keyword. When a function is newly defined, it may take one
or several values as input 'parameters' to the function and it will process the functions in the main body
and pass back the values to the functions as output 'return types'.
Every function has a function name, which describes the task that the function performs. To use a
function, you "call" that function with its name and pass input values (known as arguments) that match
the types of the function's parameters. Function parameters are also called as 'tuples'.
A function's arguments must always be provided in the same order as the function's parameter list and
the return values are followed by →.
Syntax
func funcname(Parameters) -> returntype {
Statement1
Statement2
---
Statement N
return parameters
}
Parameter
passing Parameters can provide default values to simplify function calls and can be passed as in-out parameters,
mechanism which modify a passed variable once the function has completed its execution. Every function
s in Swift has a type, consisting of the function's parameter types and return type.
When you run the above program, the output will be:
Good Morning!
Sample 1. // Hello, World! Program
program 2. import Swift
3. print("Hello, World!")
// Hello, World! Program
In Swift, any line starting with two slashes // is a comment. They are completely ignored by the compiler.
import Swift
import keyword allows you to access all the symbols defined inside a framework.For now, just remember
this line is required to use print("Hello, World!") in our program. Youll learn more about it in the later
tutorials.
print("Hello, World!")
The above line is called a function in Swift. More specifically, a print function.
In swift, print means "show on the screen". The above code prints the string inside quotation marks, i.e
"Hello, World!" on the screen
Paramete
rs
1.Value data Types
a. Predefined Data Types
Integer
Boolean
Float
b. User defined Data Types
Enumerations
Structure
2.Pointer Data Type
3.Reference data Types
a. Predefined Data Types
Objects
Strings
b. User defined Data Types
Classes
Interface
Bool, byte, char, decimal, double, float, int, long, sbyte, short, uint, ulong, ushort
Variables
Operators
1. Basic Assignment Operator
double x;
x=50.05;
2. Arithmetic Operators
+,-,*,/,%,**
3. Relational Operators
==,>,<,<=,>=,!=
4. Logical Operators
AND(&&),OR(| |)
5. Unary Operators
+,-,++,--,!
6. Ternary Operator
Expression
evaluation
(Precedence Category Operators Associativity
and
association Postfix Increment and Decrement ++, -- Left to Right
rules)
Prefix Increment, Decrement and
Unary ++, --, +, -, !, ~ Right to Left
Assignment =, +=, -=, *=, /=, %=, &=, |=, ^=, <<=, >>= Right to Left
Selection
statement
1 ifelse statement
2 simple if statement
only if statements.
Looping
statements
Sr.No. Loop Type & Description
1 while loop
2 for loop
It executes a sequence of statements multiple times and abbreviates the code that
manages the loop variable.
3 do...while loop
It is similar to a while statement, except that it tests the condition at the end of the loop
body
4 nested loops
You can use one or more loop inside any another while, for or do..while loop.
With respect to Object Oriented programming the term "Method" is used, not functions. When a function
Functions is a part of a class, it's called a method. C# is an OOP language and doesn't have functions that are
declared outside of classes, that's why all functions in C# are actually methods.
Parameter In C#, arguments can be passed to parameters either by value or by reference. Passing by reference
passing enables function members, methods, properties, indexers, operators, and constructors to change the
mechanisms value of the parameters and have that change persist in the calling environment. To pass a parameter by
reference with the intent of changing the value, use the ref, or out keyword. To pass by reference with the
intent of avoiding copying but not changing the value, use the in modifier
Sample using System;
program using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CSharpTutorials
{
class Program
{
static void Main(string[] args)
{
string message = "Hello World!!";
Console.WriteLine(message);
}
}
}
Hello World
Requirements Specification - (minimum 2 new data types and 2 new operators is to be introduced as a
part of your language
Requirements Specification:
Datatypes:
Datatype: Memory: Format Specifier: Type of datatype:
Operators:
Precedence Operator Description Associativity
1 <-1 Decrement (as i--) Left to right
1 >+1 Increment (as i+ Left to right
+)
3 ^ Multiplication Left to right
3 -:- Division Left to right
2 ++ Addition Left to right
2 -- subtraction Left to right
/<loopstatement><statements>/<conditionstatement><statements>/return<more>;
/<parallel>;<statements>/ ε
/while(id<eq>)do<statements>;/while(id<eq>)<statement>
/<conditionstatement>/return<more>; / ε
42. <conditionstatement> -->
when(<bool>)<statement><con>/when(<bool>)do<statements>;<con>
TEST CASES
1.To add the two array's and print the resultant array.
begin
num a[25],b[25],c[25],n;
outln("Enter the number of element in array");
in(n=?);
outln("Enter the elements into array a");
for(i=0;i<n;i++)
do
in(a[i]=?);
;
outln("Enter the elements into array b");
for(i=0;i<n;i++)
do
in(b[i]=?);
;
for(i=0;i<n;i++)
do
c[i]=a[i]+b[i];
;
outln("The resultant array is c=?",c);
end
DERIVATIONS
1.To add the two array's and print the resultant array.
begin
num a[25],b[25],c[25],n;
in(n=?);
for(i=0;i<n;i++)
do
in(a[i]=?);
for(i=0;i<n;i++)
do
in(b[i]=?);
for(i=0;i<n;i++)
do
c[i]=a[i]+b[i];
-->begin<declaration> <statements>end<functions>
-->begin num a[25] ,b[25],c[25],n; outln(“Enter the number of element in array”); in(id= ?
<stdin>);<statements>end<functions>
-->begin num a[25] ,b[25],c[25],n; outln(“Enter the number of element in array”); in(n= ?
<stdin>);<statements>end<functions>
-->begin num a[25] ,b[25],c[25],n; outln(“Enter the number of element in array”); in(n= ?);
outln(<stdout>);<statements>end<functions>
-->begin num a[25] ,b[25],c[25],n; outln(“Enter the number of element in array”); in(n= ?);
outln(id);<statements>end<functions>
-->begin num a[25] ,b[25],c[25],n; outln(“Enter the number of element in array”); in(n= ?); outln("Enter
the elements into array a"); for(<conditions>)do<statements>;<statements>end<functions>
-->begin num a[25] ,b[25],c[25],n; outln(“Enter the number of element in array”); in(n= ?); outln("Enter
the elements into array a"); for(<type> id=id;<exp>)do<statements>;<statements>end<functions>
-->begin num a[25] ,b[25],c[25],n; outln(“Enter the number of element in array”); in(n= ?); outln("Enter
the elements into array a"); for(id=id;<exp>)do<statements>;<statements>end<functions>
-->begin num a[25] ,b[25],c[25],n; outln(“Enter the number of element in array”); in(n= ?); outln("Enter
the elements into array a"); for(i=0;<exp>)do<statements>;<statements>end<functions>
-->begin num a[25] ,b[25],c[25],n; outln(“Enter the number of element in array”); in(n= ?); outln("Enter
the elements into array a"); for(i=0; id <eq>;<op>)do<statements>;<statements>end<functions>
-->begin num a[25] ,b[25],c[25],n; outln(“Enter the number of element in array”); in(n= ?); outln("Enter
the elements into array a"); for(i=0; id< <td>;<op>)do<statements>;<statements>end<functions>
-->begin num a[25] ,b[25],c[25],n; outln(“Enter the number of element in array”); in(n= ?); outln("Enter
the elements into array a"); for(i=0; id< id;<op>)do<statements>;<statements>end<functions>
-->begin num a[25] ,b[25],c[25],n; outln(“Enter the number of element in array”); in(n= ?); outln("Enter
the elements into array a"); for(i=0; i< n;<op>)do<statements>;<statements>end<functions>
-->begin num a[25] ,b[25],c[25],n; outln(“Enter the number of element in array”); in(n= ?); outln("Enter
the elements into array a"); for(i=0; i< n;id++)do<statements>;<statements>end<functions>
-->begin num a[25] ,b[25],c[25],n; outln(“Enter the number of element in array”); in(n= ?); outln("Enter
the elements into array a"); for(i=0; i< n;i++)do<statements>;<statements>end<functions>
-->begin num a[25] ,b[25],c[25],n; outln(“Enter the number of element in array”); in(n= ?); outln("Enter
the elements into array a"); for(i=0; i< n;i+
+)do<iostatement>;<statements>;<statements>end<functions>
-->begin num a[25] ,b[25],c[25],n; outln(“Enter the number of element in array”); in(n= ?); outln("Enter
the elements into array a"); for(i=0; i< n;i++)do in(id= ?
<stdin>);<statements>;<statements>end<functions>
-->begin num a[25] ,b[25],c[25],n; outln(“Enter the number of element in array”); in(n= ?); outln("Enter
the elements into array a"); for(i=0; i< n;i++)do in(a[i]=?
<stdin>);<statements>;<statements>end<functions>
-->begin num a[25] ,b[25],c[25],n; outln(“Enter the number of element in array”); in(n= ?); outln("Enter
the elements into array a"); for(i=0; i< n;i++)do in(a[i]=?);<statements>;<statements>end<functions>
-->begin num a[25] ,b[25],c[25],n; outln(“Enter the number of element in array”); in(n= ?); outln("Enter
the elements into array a"); for(i=0; i< n;i++)do in(a[i]=?);; outln(<stdout>);<statements>end<functions>
-->begin num a[25] ,b[25],c[25],n; outln(“Enter the number of element in array”); in(n= ?); outln("Enter
the elements into array a"); for(i=0; i< n;i++)do in(a[i]=?);; outln(id);<statements>end<functions>
-->begin num a[25] ,b[25],c[25],n; outln(“Enter the number of element in array”); in(n= ?); outln("Enter
the elements into array a"); for(i=0; i< n;i++)do in(a[i]=?);; outln("Enter the elements into array
b");<statements>end<functions>
-->begin num a[25] ,b[25],c[25],n; outln(“Enter the number of element in array”); in(n= ?); outln("Enter
the elements into array a"); for(i=0; i< n;i++)do in(a[i]=?);; outln("Enter the elements into array b");
for(<decl>;<exp>)do<statements>;<statements>end<functions>
-->begin num a[25] ,b[25],c[25],n; outln(“Enter the number of element in array”); in(n= ?); outln("Enter
the elements into array a"); for(i=0; i< n;i++)do in(a[i]=?);; outln("Enter the elements into array b");
for(<type> id=id;<exp>)do<statements>;<statements>end<functions>
-->begin num a[25] ,b[25],c[25],n; outln(“Enter the number of element in array”); in(n= ?); outln("Enter
the elements into array a"); for(i=0; i< n;i++)do in(a[i]=?);; outln("Enter the elements into array b");
for( id=id;<exp>)do<statements>;<statements>end<functions>
-->begin num a[25] ,b[25],c[25],n; outln(“Enter the number of element in array”); in(n= ?); outln("Enter
the elements into array a"); for(i=0; i< n;i++)do in(a[i]=?);; outln("Enter the elements into array b");
for( i=0 i<n;i++)do<statements>;<statements>end<functions>
-->begin num a[25] ,b[25],c[25],n; outln(“Enter the number of element in array”); in(n= ?); outln("Enter
the elements into array a"); for(i=0; i< n;i++)do in(a[i]=?);; outln("Enter the elements into array b");
for( i=0;i<n;i++)do<iostatement>;<statements>;<statements>end<functions>
-->begin num a[25] ,b[25],c[25],n; outln(“Enter the number of element in array”); in(n= ?); outln("Enter
the elements into array a"); for(i=0; i< n;i++)do in(a[i]=?);; outln("Enter the elements into array b");
for( i=0 i<n;i++)do in(id= ?<stdin>);<statements>;<statements>end<functions>
-->begin num a[25] ,b[25],c[25],n; outln(“Enter the number of element in array”); in(n= ?); outln("Enter
the elements into array a"); for(i=0; i< n;i++)do in(a[i]=?);; outln("Enter the elements into array b");
for( i=0 i<n;i++)do in(b[i]=?);;<statements>end<functions>
-->begin num a[25] ,b[25],c[25],n; outln(“Enter the number of element in array”); in(n= ?); outln("Enter
the elements into array a"); for(i=0; i< n;i++)do in(a[i]=?);; outln("Enter the elements into array b");
for( i=0 i<n;i++)do in(b[i]=?);; <loopstatement><statements>end<functions>
-->begin num a[25] ,b[25],c[25],n; outln(“Enter the number of element in array”); in(n= ?); outln("Enter
the elements into array a"); for(i=0; i< n;i++)do in(a[i]=?);; outln("Enter the elements into array b");
for( i=0 i<n;i++)do in(b[i]=?);; for(<conditions>)do<statements>;<statements>end<functions>
-->begin num a[25] ,b[25],c[25],n; outln(“Enter the number of element in array”); in(n= ?); outln("Enter
the elements into array a"); for(i=0; i< n;i++)do in(a[i]=?);; outln("Enter the elements into array b");
for( i=0 i<n;i++)do in(b[i]=?);; for(<decl>;<exp>)do<statements>;<statements>end<functions>
-->begin num a[25] ,b[25],c[25],n; outln(“Enter the number of element in array”); in(n= ?); outln("Enter
the elements into array a"); for(i=0; i< n;i++)do in(a[i]=?);; outln("Enter the elements into array b");
for( i=0 i<n;i++)do in(b[i]=?);; for(i=0;i<n;i++)do<statements>;<statements>end<functions>
-->begin num a[25] ,b[25],c[25],n; outln(“Enter the number of element in array”); in(n= ?); outln("Enter
the elements into array a"); for(i=0; i< n;i++)do in(a[i]=?);; outln("Enter the elements into array b");
for( i=0 i<n;i++)do in(b[i]=?);; for(i=0;i<n;i+
+)do<assignstatement>;<statements>;<statements>end<functions>
-->begin num a[25] ,b[25],c[25],n; outln(“Enter the number of element in array”); in(n= ?); outln("Enter
the elements into array a"); for(i=0; i< n;i++)do in(a[i]=?);; outln("Enter the elements into array b");
for( i=0 i<n;i++)do in(b[i]=?);; for(i=0;i<n;i++)do id = <more>;<statements>;<statements>end<functions>
-->begin num a[25] ,b[25],c[25],n; outln(“Enter the number of element in array”); in(n= ?); outln("Enter
the elements into array a"); for(i=0; i< n;i++)do in(a[i]=?);; outln("Enter the elements into array b");
for( i=0 i<n;i++)do in(b[i]=?);; for(i=0;i<n;i++)do c[i]=a[i]+b[i];<statements>;<statements>end<functions>
-->begin num a[25] ,b[25],c[25],n; outln(“Enter the number of element in array”); in(n= ?); outln("Enter
the elements into array a"); for(i=0; i< n;i++)do in(a[i]=?);; outln("Enter the elements into array b");
for( i=0 i<n;i++)do in(b[i]=?);; for(i=0;i<n;i++)do c[i]=a[i]+b[i];;<statements>end<functions>
-->begin num a[25] ,b[25],c[25],n; outln(“Enter the number of element in array”); in(n= ?); outln("Enter
the elements into array a"); for(i=0; i< n;i++)do in(a[i]=?);; outln("Enter the elements into array b");
for( i=0 i<n;i++)do in(b[i]=?);; for(i=0;i<n;i++)do c[i]=a[i]+b[i];;
<iostatement>;<statements>end<functions>
-->begin num a[25] ,b[25],c[25],n; outln(“Enter the number of element in array”); in(n= ?); outln("Enter
the elements into array a"); for(i=0; i< n;i++)do in(a[i]=?);; outln("Enter the elements into array b");
for( i=0 i<n;i++)do in(b[i]=?);; for(i=0;i<n;i++)do c[i]=a[i]+b[i];;
outln(<stdout>);<statements>end<functions>
-->begin num a[25] ,b[25],c[25],n; outln(“Enter the number of element in array”); in(n= ?); outln("Enter
the elements into array a"); for(i=0; i< n;i++)do in(a[i]=?);; outln("Enter the elements into array b");
for( i=0 i<n;i++)do in(b[i]=?);; for(i=0;i<n;i++)do c[i]=a[i]+b[i];; outln("The resultant array is c=?",c); end
begin
num fact, n;
in(n=?);
fact=fact(n);
end
num fact(num a)
do
when(a==1¦¦a==0)
return 1;
else
return a*fact(a-1);
--> <function><functions>begin<functionbody>end<functions>
--> <funsignature>;<function><functions>begin<functionbody>end<functions>
--> num fact (num a);begin num fact,n;outln("Enter the number to find it's
factorial");<statements>end<functions>
--> num fact (num a);begin num fact,n;outln("Enter the number to find it's
factorial");<statements>end<functions>
--> num fact (num a);begin num fact,n;outln("Enter the number to find it's
factorial");<iostatement>;<statements>end<functions>
--> num fact (num a);begin num fact,n;outln("Enter the number to find it's factorial"); in(n=?);
;<statements>end<functions>
--> num fact (num a);begin num fact,n;outln("Enter the number to find it's factorial"); in(n=?);
;<assignstatements>;<statements>end<functions>
--> num fact (num a);begin num fact,n;outln("Enter the number to find it's factorial"); in(n=?);
fact=fact(n);<statements>end<functions>
--> num fact (num a);begin num fact,n;outln("Enter the number to find it's factorial"); in(n=?);
fact=fact(n); <iostatement>;<statements>end<functions>
--> num fact (num a);begin num fact,n;outln("Enter the number to find it's factorial"); in(n=?);
fact=fact(n); outln("The factorial of ? is ? ",n,fact);<statements>end<functions>
--> num fact (num a);begin num fact,n;outln("Enter the number to find it's factorial"); in(n=?);
fact=fact(n); outln("The factorial of ? is ? ",n,fact); end<functions>
--> num fact (num a);begin num fact,n;outln("Enter the number to find it's factorial"); in(n=?);
fact=fact(n); outln("The factorial of ? is ? ",n,fact); end <function><functions>
--> num fact (num a);begin num fact,n;outln("Enter the number to find it's factorial"); in(n=?);
fact=fact(n); outln("The factorial of ? is ? ",n,fact); end <funsignature>do<functionbody>;<functions>
--> num fact (num a);begin num fact,n;outln("Enter the number to find it's factorial"); in(n=?);
fact=fact(n); outln("The factorial of ? is ? ",n,fact); end <type> id ( <params> )
do<functionbody>;<functions>
--> num fact (num a);begin num fact,n;outln("Enter the number to find it's factorial"); in(n=?);
fact=fact(n); outln("The factorial of ? is ? ",n,fact); end num fact(num a)do<functionbody>;<functions>
--> num fact (num a);begin num fact,n;outln("Enter the number to find it's factorial"); in(n=?);
fact=fact(n); outln("The factorial of ? is ? ",n,fact); end num fact(num a)do <declaration>
<statements>;<functions>
--> num fact (num a);begin num fact,n;outln("Enter the number to find it's factorial"); in(n=?);
fact=fact(n); outln("The factorial of ? is ? ",n,fact); end num fact(num a)do<statements>;<functions>
--> num fact (num a);begin num fact,n;outln("Enter the number to find it's factorial"); in(n=?);
fact=fact(n); outln("The factorial of ? is ? ",n,fact); end num fact(num
a)do<conditionstatement><statements>;<functions>
--> num fact (num a);begin num fact,n;outln("Enter the number to find it's factorial"); in(n=?);
fact=fact(n); outln("The factorial of ? is ? ",n,fact); end num fact(num a)do
when(<bool>)<statements><con><statements>;<functions>
--> num fact (num a);begin num fact,n;outln("Enter the number to find it's factorial"); in(n=?);
fact=fact(n); outln("The factorial of ? is ? ",n,fact); end num fact(num a)do when(<ex>||
<bool>)<statements><con><statements>;<functions>
--> num fact (num a);begin num fact,n;outln("Enter the number to find it's factorial"); in(n=?);
fact=fact(n); outln("The factorial of ? is ? ",n,fact); end num fact(num a)do when(a==1||
<ex>)<statements><con><statements>;<functions>
--> num fact (num a);begin num fact,n;outln("Enter the number to find it's factorial"); in(n=?);
fact=fact(n); outln("The factorial of ? is ? ",n,fact); end num fact(num a)do when(a==1||
a==0)<statements><con><statements>;<functions>
--> num fact (num a);begin num fact,n;outln("Enter the number to find it's factorial"); in(n=?);
fact=fact(n); outln("The factorial of ? is ? ",n,fact); end num fact(num a)do when(a==1||a==0)
return<more>;<con><statements>;<functions>
--> num fact (num a);begin num fact,n;outln("Enter the number to find it's factorial"); in(n=?);
fact=fact(n); outln("The factorial of ? is ? ",n,fact); end num fact(num a)do when(a==1||a==0) return
1;<con><statements>;<functions>
--> num fact (num a);begin num fact,n;outln("Enter the number to find it's factorial"); in(n=?);
fact=fact(n); outln("The factorial of ? is ? ",n,fact); end num fact(num a)do when(a==1||a==0) return
1;else return a*fact(a-1);<statements>;<functions>
--> num fact (num a);begin num fact,n;outln("Enter the number to find it's factorial"); in(n=?);
fact=fact(n); outln("The factorial of ? is ? ",n,fact); end num fact(num a)do when(a==1||a==0) return
1;else return a*fact(a-1);;
begin
num a=15,b=15;
when (a==b)
when else(a>b)
else
end
-->begin<declaration> <statements>end<functions>
-->begin num a=15,b=15; when(a==b) outln(“both the numbers are equal”); when
else(<bool>)<statement><els><statements><statements>end<functions>
-->begin num a=15,b=15; when(a==b) outln(“both the numbers are equal”); when
else(a>b)<statement><els><statements><statements>end<functions>
-->begin num a=15,b=15; when(a==b) outln(“both the numbers are equal”); when else(a>b)
<iostatement>;<statements><els><statements><statements>end<functions>
-->begin num a=15,b=15; when(a==b) outln(“both the numbers are equal”); when else(a>b)
outln(<stdout>);<statements><els><statements><statements>end<functions>
-->begin num a=15,b=15; when(a==b) outln(“both the numbers are equal”); when else(a>b) outln(“a is
greater than b”);<statements><els><statements><statements>end<functions>
-->begin num a=15,b=15; when(a==b) outln(“both the numbers are equal”); when else(a>b) outln(“a is
greater than b”); <els><statements><statements>end<functions>
-->begin num a=15,b=15; when(a==b) outln(“both the numbers are equal”); when else(a>b) outln(“a is
greater than b”); else <statement><statements><statements>end<functions>
-->begin num a=15,b=15; when(a==b) outln(“both the numbers are equal”); when else(a>b) outln(“a is
greater than b”); else <iostatement>;<statements><statements><statements>end<functions>
-->begin num a=15,b=15; when(a==b) outln(“both the numbers are equal”); when else(a>b) outln(“a is
greater than b”); else outln(<stdout>);<statements><statements><statements>end<functions>
-->begin num a=15,b=15; when(a==b) outln(“both the numbers are equal”); when else(a>b) outln(“a is
greater than b”); else outln(“b is greater than
a”);<statements><statements><statements>end<functions>
-->begin num a=15,b=15; when(a==b) outln(“both the numbers are equal”); when else(a>b) outln(“a is
greater than b”); else outln(“b is greater than a”); end<functions>
-->begin num a=15,b=15; when(a==b) outln(“both the numbers are equal”); when else(a>b) outln(“a is
greater than b”); else outln(“b is greater than a”); end
begin
swap(m,n);
end
do
num temp;
temp=a;
a=b;
b=temp;
--> <function><functions>begin<functionbody>end<functions>
--> <funsignature>;<function><functions>begin<functionbody>end<functions>
--> void swap(num a,num b); begin num m=22, n=44; <declaration><statements>end<functions>
--> void swap(num a,num b); begin num m=22, n=44; <iostatement>;<statements>end<functions>
--> void swap(num a,num b); begin num m=22, n=44; outln(<stdout>);<statements>end<functions>
--> void swap(num a,num b); begin num m=22, n=44; outln(id<st>);<statements>end<functions>
--> void swap(num a,num b); begin num m=22, n=44; outln(“values before swap m=? and
n=?”,id<st>);<statements>end<functions>
--> void swap(num a,num b); begin num m=22, n=44; outln(“values before swap m=? and
n=?”,m,id<st>);<statements>end<functions>
--> void swap(num a,num b); begin num m=22, n=44; outln(“values before swap m=? and
n=?”,m,n);<statements>end<functions>
--> void swap(num a,num b); begin num m=22, n=44; outln(“values before swap m=? and n=?”,m,n);
<assignstatement>;<statements>end<functions>
--> void swap(num a,num b); begin num m=22, n=44; outln(“values before swap m=? and n=?”,m,n);
<td>;<statements>end<functions>
--> void swap(num a,num b); begin num m=22, n=44; outln(“values before swap m=? and n=?”,m,n);
id(id<par>);<statements>end<functions>
--> void swap(num a,num b); begin num m=22, n=44; outln(“values before swap m=? and n=?”,m,n);
swap(m,id<par>);<statements>end<functions>
--> void swap(num a,num b); begin num m=22, n=44; outln(“values before swap m=? and n=?”,m,n);
swap(m,n);end<functions>
--> void swap(num a,num b); begin num m=22, n=44; outln(“values before swap m=? and n=?”,m,n);
swap(m,n);end<function><functions>
--> void swap(num a,num b); begin num m=22, n=44; outln(“values before swap m=? and n=?”,m,n);
swap(m,n);end <funsignature>do<functionbody>;<functions>
--> void swap(num a,num b); begin num m=22, n=44; outln(“values before swap m=? and n=?”,m,n);
swap(m,n);end <type> id ( <params> )do<functionbody>;<functions>
--> void swap(num a,num b); begin num m=22, n=44; outln(“values before swap m=? and n=?”,m,n);
swap(m,n);end void swap(num a, num b)do<functionbody>;<functions>
--> void swap(num a,num b); begin num m=22, n=44; outln(“values before swap m=? and n=?”,m,n);
swap(m,n);end void swap(num a, num b)do<declaration> <statements><functions>
--> void swap(num a,num b); begin num m=22, n=44; outln(“values before swap m=? and n=?”,m,n);
swap(m,n);end void swap(num a, num b)do <type><var> <variable>; <declaration>
<statements><functions>
--> void swap(num a,num b); begin num m=22, n=44; outln(“values before swap m=? and n=?”,m,n);
swap(m,n);end void swap(num a, num b)do num temp; <statements><functions>
--> void swap(num a,num b); begin num m=22, n=44; outln(“values before swap m=? and n=?”,m,n);
swap(m,n);end void swap(num a, num b)do num temp; <assignstatement>;<statements>;<functions>
--> void swap(num a,num b); begin num m=22, n=44; outln(“values before swap m=? and n=?”,m,n);
swap(m,n);end void swap(num a, num b)do num temp; <var> = <more>;<statements>;<functions>
--> void swap(num a,num b); begin num m=22, n=44; outln(“values before swap m=? and n=?”,m,n);
swap(m,n);end void swap(num a, num b)do num temp; temp = a;<statements>;<functions>
--> void swap(num a,num b); begin num m=22, n=44; outln(“values before swap m=? and n=?”,m,n);
swap(m,n);end void swap(num a, num b)do num temp; temp = a;
<assignstatement>;<statements>;<functions>
--> void swap(num a,num b); begin num m=22, n=44; outln(“values before swap m=? and n=?”,m,n);
swap(m,n);end void swap(num a, num b)do num temp; temp = a; <var> =
<more>;<statements>;<functions>
--> void swap(num a,num b); begin num m=22, n=44; outln(“values before swap m=? and n=?”,m,n);
swap(m,n);end void swap(num a, num b)do num temp; temp = a; a = b;<statements>;<functions>
--> void swap(num a,num b); begin num m=22, n=44; outln(“values before swap m=? and n=?”,m,n);
swap(m,n);end void swap(num a, num b)do num temp; temp = a; a = b;
<assignstatement>;<statements>;<functions>
--> void swap(num a,num b); begin num m=22, n=44; outln(“values before swap m=? and n=?”,m,n);
swap(m,n);end void swap(num a, num b)do num temp; temp = a; a = b; <var> =
<more>;<statements>;<functions>
--> void swap(num a,num b); begin num m=22, n=44; outln(“values before swap m=? and n=?”,m,n);
swap(m,n);end void swap(num a, num b)do num temp; temp = a; a = b; b =
temp;<statements>;<functions>
--> void swap(num a,num b); begin num m=22, n=44; outln(“values before swap m=? and n=?”,m,n);
swap(m,n);end void swap(num a, num b)do num temp; temp = a; a = b; b = temp; <iostatement>;
<statements>;<functions>
--> void swap(num a,num b); begin num m=22, n=44; outln(“values before swap m=? and n=?”,m,n);
swap(m,n);end void swap(num a, num b)do num temp; temp = a; a = b; b = temp;
outln(<stdout>);<statements>;<functions>
--> void swap(num a,num b); begin num m=22, n=44; outln(“values before swap m=? and n=?”,m,n);
swap(m,n);end void swap(num a, num b)do num temp; temp = a; a = b; b = temp; outln(“values after
swap m=? and n=?”,id<st>);<statements>;<functions>
--> void swap(num a,num b); begin num m=22, n=44; outln(“values before swap m=? and n=?”,m,n);
swap(m,n);end void swap(num a, num b)do num temp; temp = a; a = b; b = temp; outln(“values after
swap m=? and n=?”,a,id);<statements>;<functions>
--> void swap(num a,num b); begin num m=22, n=44; outln(“values before swap m=? and n=?”,m,n);
swap(m,n);end void swap(num a, num b)do num temp; temp = a; a = b; b = temp; outln(“values after
swap m=? and n=?”,a,id);;
5. Example for all assignment operators
begin
num a = 5, c;
c = a;
c += a; // c = c+a
c -= a; // c = c-a
c *= a; // c = c*a
c /= a; // c = c/a
c %= a; // c = c%a
end
-->begin<declaration> <statements>end<functions>
--> begin num a=5,c; num x,y:=2,4; outln("x = ? y=?", x,y); id = <more>;<statements>end<functions>
--> begin num a=5,c; num x,y:=2,4; outln("x = ? y=?", x,y); c = a;<statements>end<functions>
--> begin num a=5,c; num x,y:=2,4; outln("x = ? y=?", x,y); c = a; outln("c
= ?",id<st>);<statements>end<functions>
--> begin num a=5,c; num x,y:=2,4; outln("x = ? y=?", x,y); c = a; outln("c
= ?",c);<statements>end<functions>
--> begin num a=5,c; num x,y:=2,4; outln("x = ? y=?", x,y); c = a; outln("c = ?",c);
<assignstatement>;<statements>end<functions>
--> begin num a=5,c; num x,y:=2,4; outln("x = ? y=?", x,y); c = a; outln("c = ?",c); id <assign> id
;<statements>end<functions>
--> begin num a=5,c; num x,y:=2,4; outln("x = ? y=?", x,y); c = a; outln("c = ?",c); c += a
;<statements>end<functions>
--> begin num a=5,c; num x,y:=2,4; outln("x = ? y=?", x,y); c = a; outln("c = ?",c); c += a
;<iostatement>;<statements>end<functions>
--> begin num a=5,c; num x,y:=2,4; outln("x = ? y=?", x,y); c = a; outln("c = ?",c); c += a ;
outln(<stdout>);<statements>end<functions>
--> begin num a=5,c; num x,y:=2,4; outln("x = ? y=?", x,y); c = a; outln("c = ?",c); c += a ;
outln(id<st>);<statements>end<functions>
--> begin num a=5,c; num x,y:=2,4; outln("x = ? y=?", x,y); c = a; outln("c = ?",c); c += a ; outln("c
= ?",id<st>);<statements>end<functions>
--> begin num a=5,c; num x,y:=2,4; outln("x = ? y=?", x,y); c = a; outln("c = ?",c); c += a ; outln("c = ?",c);
<assignstatement>;<statements>end<functions>
--> begin num a=5,c; num x,y:=2,4; outln("x = ? y=?", x,y); c = a; outln("c = ?",c); c += a ; outln("c = ?",c);
id <assign> id ;<statements>end<functions>
--> begin num a=5,c; num x,y:=2,4; outln("x = ? y=?", x,y); c = a; outln("c = ?",c); c += a ; outln("c = ?",c);
c -= a;<statements>end<functions>
--> begin num a=5,c; num x,y:=2,4; outln("x = ? y=?", x,y); c = a; outln("c = ?",c); c += a ; outln("c = ?",c);
c -= a; ;<iostatement>;<statements>end<functions>
--> begin num a=5,c; num x,y:=2,4; outln("x = ? y=?", x,y); c = a; outln("c = ?",c); c += a ; outln("c = ?",c);
c -= a; outln(<stdout>);<statements>end<functions>
--> begin num a=5,c; num x,y:=2,4; outln("x = ? y=?", x,y); c = a; outln("c = ?",c); c += a ; outln("c = ?",c);
c -= a; outln(id<st>);<statements>end<functions>
--> begin num a=5,c; num x,y:=2,4; outln("x = ? y=?", x,y); c = a; outln("c = ?",c); c += a ; outln("c = ?",c);
c -= a; outln("c = ?",c);<statements>end<functions>
--> begin num a=5,c; num x,y:=2,4; outln("x = ? y=?", x,y); c = a; outln("c = ?",c); c += a ; outln("c = ?",c);
c -= a; outln("c = ?",c);<statements>end<functions>
--> begin num a=5,c; num x,y:=2,4; outln("x = ? y=?", x,y); c = a; outln("c = ?",c); c += a ; outln("c = ?",c);
c -= a; outln("c = ?",c); <assignstatement>;<statements>end<functions>
--> begin num a=5,c; num x,y:=2,4; outln("x = ? y=?", x,y); c = a; outln("c = ?",c); c += a ; outln("c = ?",c);
c -= a; outln("c = ?",c); id <assign> id ;<statements>end<functions>
--> begin num a=5,c; num x,y:=2,4; outln("x = ? y=?", x,y); c = a; outln("c = ?",c); c += a ; outln("c = ?",c);
c -= a; outln("c = ?",c); c *= a;<statements>end<functions>
--> begin num a=5,c; num x,y:=2,4; outln("x = ? y=?", x,y); c = a; outln("c = ?",c); c += a ; outln("c = ?",c);
c -= a; outln("c = ?",c); c *= a;<iostatement>;<statements>end<functions>
--> begin num a=5,c; num x,y:=2,4; outln("x = ? y=?", x,y); c = a; outln("c = ?",c); c += a ; outln("c = ?",c);
c -= a; outln("c = ?",c); c *= a;outln(<stdout>);<statements>end<functions>
--> begin num a=5,c; num x,y:=2,4; outln("x = ? y=?", x,y); c = a; outln("c = ?",c); c += a ; outln("c = ?",c);
c -= a; outln("c = ?",c); c *= a;outln(id<st>);<statements>end<functions>
--> begin num a=5,c; num x,y:=2,4; outln("x = ? y=?", x,y); c = a; outln("c = ?",c); c += a ; outln("c = ?",c);
c -= a; outln("c = ?",c); c *= a;outln("c = ?",c);<statements>end<functions>
--> begin num a=5,c; num x,y:=2,4; outln("x = ? y=?", x,y); c = a; outln("c = ?",c); c += a ; outln("c = ?",c);
c -= a; outln("c = ?",c); c *= a;outln("c = ?",c);
<assignstatement>;<statements>end<functions>end<functions>
--> begin num a=5,c; num x,y:=2,4; outln("x = ? y=?", x,y); c = a; outln("c = ?",c); c += a ; outln("c = ?",c);
c -= a; outln("c = ?",c); c *= a;outln("c = ?",c); id <assign> id ;<statements>end<functions>
--> begin num a=5,c; num x,y:=2,4; outln("x = ? y=?", x,y); c = a; outln("c = ?",c); c += a ; outln("c = ?",c);
c -= a; outln("c = ?",c); c *= a;outln("c = ?",c); c *= a;<statements>end<functions>
--> begin num a=5,c; num x,y:=2,4; outln("x = ? y=?", x,y); c = a; outln("c = ?",c); c += a ; outln("c = ?",c);
c -= a; outln("c = ?",c); c *= a;outln("c = ?",c); c /= a; <iostatement>;<statements>end<functions>
--> begin num a=5,c; num x,y:=2,4; outln("x = ? y=?", x,y); c = a; outln("c = ?",c); c += a ; outln("c = ?",c);
c -= a; outln("c = ?",c); c *= a;outln("c = ?",c); c /= a; outln(<stdout>);<statements>end<functions>
--> begin num a=5,c; num x,y:=2,4; outln("x = ? y=?", x,y); c = a; outln("c = ?",c); c += a ; outln("c = ?",c);
c -= a; outln("c = ?",c); c *= a;outln("c = ?",c); c /= a; outln(id<st>);<statements>end<functions>
--> begin num a=5,c; num x,y:=2,4; outln("x = ? y=?", x,y); c = a; outln("c = ?",c); c += a ; outln("c = ?",c);
c -= a; outln("c = ?",c); c *= a;outln("c = ?",c); c /= a; outln("c = ?",c);<statements>end<functions>
--> begin num a=5,c; num x,y:=2,4; outln("x = ? y=?", x,y); c = a; outln("c = ?",c); c += a ; outln("c = ?",c);
c -= a; outln("c = ?",c); c *= a;outln("c = ?",c); c /= a; outln("c = ?",c);
<assignstatement>;<statements>end<functions>
--> begin num a=5,c; num x,y:=2,4; outln("x = ? y=?", x,y); c = a; outln("c = ?",c); c += a ; outln("c = ?",c);
c -= a; outln("c = ?",c); c *= a;outln("c = ?",c); c /= a; outln("c = ?",c); id <assign> id
;<statements>end<functions>
--> begin num a=5,c; num x,y:=2,4; outln("x = ? y=?", x,y); c = a; outln("c = ?",c); c += a ; outln("c = ?",c);
c -= a; outln("c = ?",c); c *= a;outln("c = ?",c); c /= a; outln("c = ?",c); c %= a;
<iostatement>;<statements>end<functions>
--> begin num a=5,c; num x,y:=2,4; outln("x = ? y=?", x,y); c = a; outln("c = ?",c); c += a ; outln("c = ?",c);
c -= a; outln("c = ?",c); c *= a;outln("c = ?",c); c /= a; outln("c = ?",c); c %= a;
outln(<stdout>);<statements>end<functions>
--> begin num a=5,c; num x,y:=2,4; outln("x = ? y=?", x,y); c = a; outln("c = ?",c); c += a ; outln("c = ?",c);
c -= a; outln("c = ?",c); c *= a;outln("c = ?",c); c /= a; outln("c = ?",c); c %= a;
outln(id<st>);<statements>end<functions>
--> begin num a=5,c; num x,y:=2,4; outln("x = ? y=?", x,y); c = a; outln("c = ?",c); c += a ; outln("c = ?",c);
c -= a; outln("c = ?",c); c *= a;outln("c = ?",c); c /= a; outln("c = ?",c); c %= a; outln("c
= ?",c);<statements>end<functions>
--> begin num a=5,c; num x,y:=2,4; outln("x = ? y=?", x,y); c = a; outln("c = ?",c); c += a ; outln("c = ?",c);
c -= a; outln("c = ?",c); c *= a;outln("c = ?",c); c /= a; outln("c = ?",c); c %= a; outln("c = ?",c);
end<functions>
--> begin num a=5,c; num x,y:=2,4; outln("x = ? y=?", x,y); c = a; outln("c = ?",c); c += a ; outln("c = ?",c);
c -= a; outln("c = ?",c); c *= a;outln("c = ?",c); c /= a; outln("c = ?",c); c %= a; outln("c = ?",c); end
begin
num a,b,c,d,e,f,sum=0;
in(a=?,b=?,c=?,d=?,e=?,f=?);
sum=a*b+c/d%e-f;
outln(“sum=?”,sum);
end
-->begin<declaration> <statements>end<functions>
-->begin num a ,b,c,d,e,f,sum = 0; outln(“Enter the values”); in(a= ? ,b=?,c=?,d=?,e=?,f= ?); sum =
<expressin>;<statements>end<functions>
-->begin num a ,b,c,d,e,f,sum = 0; outln(“Enter the values”); in(a= ? ,b=?,c=?,d=?,e=?,f= ?); sum =
<sub><plus>;<statements>end<functions>
-->begin num a ,b,c,d,e,f,sum = 0; outln(“Enter the values”); in(a= ? ,b=?,c=?,d=?,e=?,f= ?); sum =
<mul><minus><plus>;<statements>end<functions>
-->begin num a ,b,c,d,e,f,sum = 0; outln(“Enter the values”); in(a= ? ,b=?,c=?,d=?,e=?,f= ?); sum =
<div><mult><minus><plus>;<statements>end<functions>
-->begin num a ,b,c,d,e,f,sum = 0; outln(“Enter the values”); in(a= ? ,b=?,c=?,d=?,e=?,f= ?); sum =
<mod><divs><mult><minus><plus>;<statements>end<functions>
-->begin num a ,b,c,d,e,f,sum = 0; outln(“Enter the values”); in(a= ? ,b=?,c=?,d=?,e=?,f= ?); sum =
<power><mods><divs><mult><minus><plus>;<statements>end<functions>
-->begin num a ,b,c,d,e,f,sum = 0; outln(“Enter the values”); in(a= ? ,b=?,c=?,d=?,e=?,f= ?); sum =
<root><mods><divs><mult><minus><plus>;<statements>end<functions>
-->begin num a ,b,c,d,e,f,sum = 0; outln(“Enter the values”); in(a= ? ,b=?,c=?,d=?,e=?,f= ?); sum =
id<mods><divs><mult><minus><plus>;<statements>end<functions>
-->begin num a ,b,c,d,e,f,sum = 0; outln(“Enter the values”); in(a= ? ,b=?,c=?,d=?,e=?,f= ?); sum =
a<mult><minus><plus>;<statements>end<functions>
-->begin num a ,b,c,d,e,f,sum = 0; outln(“Enter the values”); in(a= ? ,b=?,c=?,d=?,e=?,f= ?); sum =
a*<div><mult><minus><plus>;<statements>end<functions>
-->begin num a ,b,c,d,e,f,sum = 0; outln(“Enter the values”); in(a= ? ,b=?,c=?,d=?,e=?,f= ?); sum = a*
<mod><divs><mult><minus><plus>;<statements>end<functions>
-->begin num a ,b,c,d,e,f,sum = 0; outln(“Enter the values”); in(a= ? ,b=?,c=?,d=?,e=?,f= ?); sum = a*
<power><mods><divs><mult><minus><plus>;<statements>end<functions>
-->begin num a ,b,c,d,e,f,sum = 0; outln(“Enter the values”); in(a= ? ,b=?,c=?,d=?,e=?,f= ?); sum = a*
<root><mods><divs><mult><minus><plus>;<statements>end<functions>
-->begin num a ,b,c,d,e,f,sum = 0; outln(“Enter the values”); in(a= ? ,b=?,c=?,d=?,e=?,f= ?); sum = a*
b<mods><divs><mult><minus><plus>;<statements>end<functions>
-->begin num a ,b,c,d,e,f,sum = 0; outln(“Enter the values”); in(a= ? ,b=?,c=?,d=?,e=?,f= ?); sum = a*
b<plus>;<statements>end<functions>
-->begin num a ,b,c,d,e,f,sum = 0; outln(“Enter the values”); in(a= ? ,b=?,c=?,d=?,e=?,f= ?); sum = a*
b+<sub><plus>;<statements>end<functions>
-->begin num a ,b,c,d,e,f,sum = 0; outln(“Enter the values”); in(a= ? ,b=?,c=?,d=?,e=?,f= ?); sum = a*
b+c/d%e-f;<statements>end<functions>
-->begin num a ,b,c,d,e,f,sum = 0; outln(“Enter the values”); in(a= ? ,b=?,c=?,d=?,e=?,f= ?); sum = a*
b+c/d%e-f; <iostatement>;<statements>end<functions>
-->begin num a ,b,c,d,e,f,sum = 0; outln(“Enter the values”); in(a= ? ,b=?,c=?,d=?,e=?,f= ?); sum = a*
b+c/d%e-f; outln(<stdout>);<statements>end<functions>
-->begin num a ,b,c,d,e,f,sum = 0; outln(“Enter the values”); in(a= ? ,b=?,c=?,d=?,e=?,f= ?); sum = a*
b+c/d%e-f; outln(id<st>);<statements>end<functions>
-->begin num a ,b,c,d,e,f,sum = 0; outln(“Enter the values”); in(a= ? ,b=?,c=?,d=?,e=?,f= ?); sum = a*
b+c/d%e-f; outln(“sum=?”,id<st>);<statements>end<functions>
-->begin num a ,b,c,d,e,f,sum = 0; outln(“Enter the values”); in(a= ? ,b=?,c=?,d=?,e=?,f= ?); sum = a*
b+c/d%e-f; outln(“sum=?”,sum);<statements>end<functions>
-->begin num a ,b,c,d,e,f,sum = 0; outln(“Enter the values”); in(a= ? ,b=?,c=?,d=?,e=?,f= ?); sum = a*
b+c/d%e-f; outln(“sum=?”,sum); end<functions>
-->begin num a ,b,c,d,e,f,sum = 0; outln(“Enter the values”); in(a= ? ,b=?,c=?,d=?,e=?,f= ?); sum = a*
b+c/d%e-f; outln(“sum=?”,sum); enden
LIMITATIONS OF PROGRAMMING LANGUAGE
This programming language is not suitable for the 3D objects like circle, sphere.
It is just for those objects which are having lines like square, rectangle, triangle etc.
It finds an angle which approximately correct no exact values in decimal is possible to find.
No multiple inheritance is allowed.
More memory consumption.
Thinking functionally can be difficult for some tasks and applications.
FUTURE SCOPE
CONCLUSION
A programming language is a computer language engineered to create a standard form of
commands. These commands can be interpreted into a code understood by a machine.
Programming languages are always associated to one domain. This report will give an idea of a
programming language associated to 3D objects. Also it will give the specification required for
the development of a programming language. In this a line is shown how it is joined by
connecting two points. For that line, there are few test cases and the derivations for each test
cases. Different data types are used for defining functions like points, line, the angle on which it
is inclined. Some of the different terms are used for printing the output that is displaying on the
screen, for reading the input, also for conditions used.
References:
https://home.deib.polimi.it/pradella/PL.html
https://medium.com/@ibrahimgrses/contemporary-issues-in-the-design-of-a-new-language-
6b64d00a3c51
https://tomassetti.me/resources-create-programming-languages/
https://www.quora.com/How-can-you-design-a-new-programming-language
https://hackernoon.com/considerations-for-programming-language-design-a-rebuttal-
5fb7ef2fd4ba