authorimg

language of education sector p++ programming language

Alberto

5.0

Here is Your Sample Download Sample 📩

INTRODUCTION

We are in the early edge of the 21st century, the era of Technological accomplishments, advancement, computerization and the deep storm of bundled of programming languages. To cope with the situation, various business houses, organizations, startups choose programming languages to use in their applications by majoring that programming language on various scales like - is open source or not, speed, durability, security, implementation cost, ease of making maintenance on existing system and other. After performing some critical thinking, I am able to finalize the name of the new programming language and that is " P++".

Name of programming language: P++ is a yet another programming language. This is a  programming language for a quick and easy hybrid programming paradigms of Object-Oriented Programming and Functional Programming. It is a server-side scripting language like PHP. The syntax is very close to PHP Programming Language. As this is going to be uses in education sector there are some built-in incorporated features plug-ins like course creation and assignment, certificate design GUI toolsPayment gateway, video editing/making library, reporting tools, gamification and other. The main purpose of this language is to fulfill all the basic need to education industry from bottom to top all processes. By adopting this as a language in application it easy and less time consuming for creating a good verse Education Application that will fulfill all the need of the education industry. Gamification and Reporting tools are some built-in tools provided in this programming language through which we can easily achieve the target of majoring learners performance. We can use HTML, CSS, JQuery, JavaScript as a client-side to strengthen the application and designed the interactive application as per your requirements. You can use MySQL as a database with it to store the data in the backend, but in addition to this MySQL, one can use any other database management tools to fulfill all the need you are looking for.

Language and Compiler Design Definition

The programming language is all about the compiler in general. Writing a robust compiler is a resultant a programming language robust. The compiler is a program that reads source code written in a specific language and translate it into a machine-readable format called target language. It reports error if anything found un-wanted or un-necessary written that does not match it's token and other internal pieces of stuff.

As mentioned in Modern Compiler Design Associated Supplemental Materials C Implementation Details By David Galles.  Basically, any compiler play around Lexical, Syntactic, Semantic process, Intermediate Code Generation, Code Optimization and Machine Code Generation.

After the process with syntax and semantic analysis, this compiler will generate as explicit intermediate representation of the source program. This kind of representation has 2 important features:  it should be easy to produce and easy to translate the code into the target code. An operation that visits each and every node and performs a function on it. An alternative, let each node handle its own process at their own end.           

The code optimizer one of the phases in compiler design is used to improve the intermediate code so that it can run faster on machine code to get the faster result. There is a great variation in the amount of code optimization different compilers perform.

 

Once coder codes its program. The compiler takes the code and passes it to LEXER to do the process with, Lexer result into TOKENS, Parser takes than TOKENS and process it into NODES, now the responsibility of Interpreter to take NODES and process it into OBJECT and this object at runtime can be used for the final processing. 

The final and last phase of the compiler is the generation of machine/target code, consisting normally re-locatable machine code. Memory locations are selected for each of the variables used by the program.

Overview and Features

  • P++ was developed at Federation University as a general-purpose application programming language. 
  • Lightweight: as there is nothing to include for basic it is easy to code and executes.
  • It is a 'high level' programming language.
  • It is a strongly typed programming language.
  • Simplicity: Writing code in this program is so simple, as most of the syntax and key terms used are in simple English language. Anyone with the basic of English language will be able to write the code in this programming.
  • Faster: Faster as compare to other available programming language.
  • Follow OOPs Paradigm: It is an object-oriented programming language with Multiple inheritances Support. OOPs is a paradigm in which Object data and functions can be group together for processing with it.  This programming uses all the features of the programming language like - Inheritance, Abstraction, Data Hiding, Polymorphism, 
  • Data Type: It supports a huge stack of the data type. Apart from these, we can create our own data type using class (OOP)
  • Like other high-level languages, it is more portable and maintainable.
  • Type checking:  Yes, there is a built-in function to check the type of data variable, using typeof(param1).

For example:

%

int i=10+20;

echo  typeof(i); /. This will give us type of the i, that is again an integer.

%

  • Type conversation: Type can be converted from one primitive data type two another as mentioned below:

From float to int

%

float f=20.2;

f = toType(f, int); // toType(param1, param2) 

echo f;

%

Param1 is a variable itself and param2 is a type you want the conversation too.

  • Restricted aliasing: Aliasing is the way in which one value of value assigned to another variable. That means modifying one value modified for all its alias, which may not be expected by the programmers. If some case programmer forgot to check this may be a huge mistake. 

So in P++ there is no aliasing anymore without an alert, it shows alert at the time of writing code an assigning with the same variable.

  • There are too many languages in the world until now and in few of them multiple inherence can be implemented, but in this programming language we have the focus of various new things, multiple inheritances is one of them.
  • File Extension: .pp
  • Every statement in ends with a semi colon(;).
  • Every function name prefixed with ();
  • function start with function key like PHP
  • Example of function: 

%

function First(){

 echo "Hello World!!"; 

}

%

  • It is a case sensitive programming language that means 'a' and 'A' have different meaning as an identifier.
  •  Braces '{' and '}' groups statements together and are equivalent to the words "begin of the code block" and "end of the code block" respectively. 
  • Example code:

/* first.pp*/

echo "Welcome to P++ Programming language This is first ever program.";

  • Memory Management: As its name suggests, it is the process of allocating memories for an object, de-allocate that memory if it is not being used for a long time and release this for new objects or process. 

When the heap is full it is the responsibility of program internal process to clean this up. There is nothing to do with manually, the language garbage collector will be able to do it on their own. For memory, if program execution gets close, all memory will be released from the program. Programmers or developers need not do anything about it.

  • Course Plugin: by using this, one will be able to create a course, assign a course to students.
  • Student Plugin: One can get all student-related feature like - the creation of the student, update in student record, perform some operation in terms of selection, deletion and reporting can be done after using this.
  • Report Plugin: one can see the various kinds of reports once enable this plugin performance report. 
  • Payment Plugin: this has been provided in this language for receiving the payment of the students. Few languages provide these kinds of inbuilt features along with their programs.
  • Gamification: again, this is a kind of report through which we can major the performance. Like - we can get top 10 students rank wise in any cause.

We can get which is devoting more time to which course. We can get where the students are lacking. We can which students completed this course first and subsequent respectively.

P++ Programming Structure And Syntax

Variable Declaration: variable can be declare like C style.

int var1;  // var1 is a variable

int arr1[20] // Array declaration with name arr1 and size 20

Global Data Definitions (optional): These define external (global) data items (variables) that are to be widely available for use in the main program and program functions.

Scripting Block:

Any code must be written inside the block to execute with this programming language.

%

// code inside this block

%

Comments: these can appear anywhere in the program or in any applicable file.

It supports 2 kinds of comments:

For single Line comments:

// comment 1

# comment 2

Multi-line comments:

/* this is multi-line comments */

Including or importing file: For basic programming language there is nothing to include but yes for graphical or any high-level code you will have to include some file. And syntax for including file is:

include 'file pathname' or import  'file pathname' 

Example: include 'ab.p++';

Multiple files can also be included with file name separated by comma like-minded

include 'file1.p++, file2.p++';

import   'file1.p++, file2.p++';

Function Definitions: A  function contains a group of statements to achieve a particular task. These will contain both data definitions and code instructions to be executed while the program calls it.

%

Example of function: 

function Fun1(){

int a=5;

int b= 10; 

echo "Addition of a and b is" " . a+b ; 

}

%

In this programming language function parameter can be passed as both either pass by value or pass of reference.

String concatenation: String can be concatenated by using dot(.) operator.

Web scripting language: As it is a web scripting language we can write HTML tags and program in the same file to fulfill our purpose.

Static and Non-static support and scope: Static can be used for data persistency until session lasts.

Scope of code: like Java Programming language it supports all the scope. 

Image result for scope in java

Data Type: It supports various data type as mentioned below. Apart from these we can create our own data type using class (OOP)

Image result for data type in java

Constant Variables: a variable can be declared using a const key as a prefix, as stated below:

%

const int age=20;

%

for accessing we can simply use 'age'.

to print constant age

echo age;

Statements:

Assignment statement: assignment can be done using = operation like any c, c++,java style programming.

int i= 10; // that means i assigned with 10.

Arithmetic Operators: Arithmetic operators remains the same like c or Java

b/a*c is equivalent to (b/a)*c

Exception Handling: As per 'The Complete Reference in JAVA 7th Edition By Herbert Schildt',  2 types of errors are there, 1st one is compiled time error and the last one is a runtime error. A program can start executing until we remove all the syntax and semantic error. Exceptions are a runtime error, these are generated at the time of processing of the program due to some wrong input, memory exhausted or other.  An exception is a program event that may interrupt the flow of program execution.

Exception can be handled by using try, catch and throw

 

Syntax for Exception Handling

%

try {

   // Proposed code where there is a chances of being an exceptions

} catch (ExceptionName e1) {

   // Catch block with the error message what you want to display on the screen.

}

%

Example Program:

%

try {

         int a[] = new int[2];

         echo "Access element three :" . a[3] ;

      } catch (ArrayIndexOutOfBoundsException e) {

         echo "Exception thrown here :". e;

      }

      echo "Out of the exception block";

   }   

%

OOPs: Syntax across the programming languages remains the same, in P++ it also remains like in PHP or JAVA. P++ supports all the oops feature of PHP and JAVA. But in P++ it also multiple inheritances unlike Java or PHP. 

The  Object Oriented concepts in P++ are:

  • Class- Class is a basic building block of P++, where object data and it's behavior can be group together to indentifies a single entity.
  • Objects: Any real-world entity that exists or can imagine and have some properties or behavior or both is an object. 
  • Inheritance: Inheritance is the way through which we can reuse the code and get super class features into to extended class(child class).
  • Abstraction: It is the way through which one can achieve the data hiding technique
  • Interface: Again this is the way through which we can achieve complete abstraction. There are few of programming language that support Multiple inheritances, but this P++ also support multiple inheritances. 
  • Constructor
  • Polymorphism: Polymorphism is the way through which we can implement both binding run time binding and static binding. Polymorphism can be of 2 type:

1. Overloading

2.  Overriding 

Lets understand the complete structure by example program

Example 1: Basic with HTML

HTML part of P++ Programming lanaguage

Hello World!

Example 2: P++ conversion of for above program

HTML part of P++ Programming lanaguage

%

echo " Hello World! "  // print the Hello World

// This is Comment

%

Example 3: Single Inheritance

class Animal

{

    String name;

    public function Greet()

    {

        return "I'm some a Super Class Animal and my name is: " . $this->name;

    }

}

class Dog extends Animal

{

    public function Greet()

    {

        return "I'm a dog and and my name in the Child Class is: " . $this->name;

    }

}

Object Creation and calling function of above program

$an = new Animal(); // creating an object of super class

echo $an->Greet();  // output I'm some a Super Class Animal and my name is: 

$animal = new Dog(); // Creating an object of child class Dog

$animal->name = "Bob"; // Modifying name wiht Bob

echo $animal->Greet(); // Output: I'm a dog and and my name in the Child Class is: Bob

Abstraction Program Example:

abstract class AbsClass

{

abstract protected function getVal();

    abstract protected function prefixVal();

    public function print() {

        echo "Hello how are you?";