0% found this document useful (0 votes)
16 views19 pages

CMP 332 -Lect-1

The document outlines an introductory lecture on programming languages, covering definitions, structures, classifications, and the importance of programming languages in software development. It discusses various programming languages, their characteristics, and the reasons for their existence. Additionally, it emphasizes the role of programming languages as a means of communication between humans and machines.

Uploaded by

tomiekun00
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views19 pages

CMP 332 -Lect-1

The document outlines an introductory lecture on programming languages, covering definitions, structures, classifications, and the importance of programming languages in software development. It discusses various programming languages, their characteristics, and the reasons for their existence. Additionally, it emphasizes the role of programming languages as a means of communication between humans and machines.

Uploaded by

tomiekun00
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

CMP 332

SURVEY OF PROGRAMMING OF PROGRAMMING LANGUAGES


OVERVIEW OF PROGRAMING LANGUAGES

LECTURE ONE

Delivered by: Dr. T. A Olowookere


Lesson objectives
By the end of this lesson, students should be able to:

Understand programming and programming language


Describe flow of programming language
Describe the structure of programming language
Describe different classification of programming language
Identify why are there so many programming languages
Identify what makes a language successful
Describe importance of programming language
What is Programming?
A program is a set of instructions used in performing specific task. Therefore, Programming is an act of
writing programs.
Programming is the act of coding, modeling, simulating or presenting the solution to a problem, by
representing facts, data or information using pre-defined rules and semantics, on a computer or any other
device for automation.

Meaning of Programming Language


A programming language is a formal language, which comprises a set of instructions that produce various
kinds of output. Programming languages are used in computer programming to implement algorithms.

It is a vocabulary and set of grammatical rules for instructing a computer or computing device to perform
specific tasks.

Programming Languages are important for software technologies. It is a key factor to every software.

There are different programming languages that are currently trendy. Such as:
• C
• C++
• Java
• C#
• Python
• Ruby. etc
Flow of programming Languages
Compiler

Compiler is an intermediary to understand each language. Compiler converts High-level


languages to low level languages as well as low level languages to high level languages.
Each language needs at least one compiler. Without compiler we could not understand low level
language outputs.

Input

Output
Structure of Programming Languages

Syntax: a set of rules that determine what is a legal string---which strings belong to the
language, which don't

Semantics: a set of rules that associate a meaning with each legal string of the language.

Syntactic structure is defined by:

 An alphabet (what are legal characters)


 Lexical structure: formation of strings of legal characters into lexical units (legal
tokens)
 Parse structure: formation of sequences of legal tokens into grammatical units (legal
constructs)
Structure of Programming Languages

Each programming Language has separate structure.


Header file is some supporting files. It is located at the top of program. Header file is the head of
program. We call header file a different name in different languages. Like bellow.

Header File -> C Language


Header File -> C++ Language
Package -> Java Language
Namespace -> C# Language
Package -> Python Language

Main Function is important part of programming languages. Main function is like our body, each
and every function happens in main function section. Main function is starting point of
programming languages. Sub function is optional one. If needed it we can use, otherwise leave it.

All programming language is syntax wise different apart from others, these are same. For
example if I need to print one line using any programming language, see below:
For Example:
// Main Method in C#
static public void Main(String[] args)
{

Meaning of the Main Syntax:

static: It means Main Method can be called without an object.


public: It is access modifiers which means the compiler can execute this from anywhere.
void: The Main method doesn’t return anything.
Main(): It is the configured name of the Main method.
String []args: For accepting the zero-indexed command line arguments.
All programming language is syntax wise different apart from others, these are same. For
example if I need to print one line using any programming language, see below:

printf(“Welcome To C# Corner”) C Language

cout<<”Welcome To C# Corner”; C++ Language

System.out.print(“Welcome To C# Corner”);
Java Language

Console.WritLine(“Welcome To C#
C# language
Corner”);

print(‘Welcome to Python!') Python Language


A Comparative Example
A classification of languages
There are many systems of classifying languages, but for the present purposes the following division into four kinds
of languages seems appropriate.
Traditional programming languages include C, Pascal, Java, and many more; a first course in just
"programming" will usually teach programming in one of these (but the exact choice beyond that has varied
considerably over time). Common for these is that one uses an external compiler to transform source code into
executable code (often but not always native machine code for the computer you run the compiler on). Primary
concerns are speed of the executable code, detail specification of what should be done, and the ability to write
large programs.
Dynamic programming languages (also known as 'scripting languages') do typically not have a separate
compiler; they may be interpreted (parse one instruction and then immediately execute it), compiled (at the time
you run the program), or a combination thereof. Primary concerns are that programs should be easy to write and
modify. Dynamic programming languages can often be run interactively, where you type instructions at a
prompt and see them executed in turn.
Specialised programming languages are in principle similar to the dynamic programming languages, but with a
particular focus on one kind of data or one problem domain. This class includes the major computer algebra
systems (Maple, Mathematica, Maxima), the matrix-oriented Matlab, and the statistics-oriented language R.
Unconventional programming languages is a catch-all category for "everything else". These are things which
you can use for programming, but may be strange to use as such. If you end up in this category, you're probably
doing something very clever or something very stupid, possibly both.
Notes on specific languages
.Traditional languages
C is a near low level language — it's been described as "structured assembly language" — but it constitutes a reference point to which most later
languages have needed to relate themselves (as evidenced by the large number of languages that are named 'C-something').
The main thing to realize about C is that everything you write maps very directly onto machine code. The good thing about this is that C lets you do pretty
much anything. It is perfectly possible to code anything in C, but it requires knowing what you're doing and also some discipline to keep things sane. Coding
something in C means you're starting at a very low level, even if there are plenty of code libraries out there which might provide you with higher level
operations.
C++ (a name that may be interpreted as "successor of C") is an extension of C with features for object-oriented programming (OOP), which simplifies
higher-level programming. C++ is a very large language, both because it contains all of C in addition to the object-oriented extensions, and because of
how these extensions were implemented; a design goal has been that programmers should be free to pick their own programming style (meaning that
C++ should support some realization of said style, for every style imaginable).
A good thing about C++ is that it comes with a standard library of data structures, that cater for most needs one tends to have in that direction. A problem
can however be that the design of this library prioritizes being optimal (in the eyes of theoretical computer scientists of the 1990's), so sometimes the
interfaces may appear obscure to the user who is not schooled in computer science.
C# (Microsoft), Java (Sun/Oracle), and Objective-C (Apple) are three other languages that — like C++ — aim to be "similar to C, but higher level with
object-orientation". Whereas C++ aims to support everything, these three are more inclined to pick one thing as the "correct" way of doing something,
which allows them to be smaller. Another difference is that they are all being promoted by a particular company (as indicated), either because the
language was invented there, or because it got adopted by the company.
Haskell is a pure functional programming language (in contrast to the imperative nature of mainstream programming languages); this makes it close to
pure mathematics, but can also make it hard to comprehend. The language has ties to category theory, which places it in high regard in certain research
communities. The reason it is listed under "Traditional languages" is that one still uses a compiler to produce executable code.
Dynamic languages
JavaScript (or ECMA-script, as is nowadays the official name) is a dynamic programming language most known for its use in web pages (client-side scripting),
but it is in fact a general programming language. Some nice things about it is that it is probably the most widely deployed dynamic language today (pretty much
every web browser has it built in), it is fairly easy to make user interfaces for it (embed your program in an HTML file that serves as the user interface), and it's
pretty fast (because much effort has been spent on optimizing engines for it) for being a dynamic programming language. A disadvantage is that since it's
predominantly being used for scripting in webpages, it might be hard to find information about how to use this language for doing anything else.
LISP is one of the oldest programming languages there is, and for many decades the obvious choice for anything "AI" (which was short for "Artificial
Intelligence", but in practice could mean just about any computation that was not on simple numerical data). Though since the 1990's not fashionable anymore, it
remains among the languages used for doing mathematical things, and the ELISP dialect is built into every Emacs editor.
A close (and more modern) relative of LISP is Scheme. There is a rigorous definition distinguishing dialects of LISP from dialects of Scheme, but the details are
somewhat technical (i.e., unless you know what to look for it might as well appear to be two dialects of a single language).
A word of warning is that LISP (and Scheme) handles data at a pretty low level (similar to how C programs are close to machine code: you can express things
using only structured concepts, but they really map onto lower level realizations, and there is little cushioning); this is in part due to the age of the language, as
early LISP programs had to keep their data in very tiny memories (by today's standards). If you choose to use LISP, then you need to be aware of things like how
what looks like a list of items is actually a linked list of cons cells, since most language operations presume that you know this.
Python is probably the most fashionable dynamic language for mathematical/scientific calculations nowadays. It fits well within the current programming
language mainstream, except perhaps in that it uses indentation to encode (rather than just indicate) block structures in programs.
Tcl is a very simple language, and may as such be appropriate for the beginner programmer, although some experienced programmers are confounded by it
because the language does not implicitly do several things that they may be used to from other languages (such as distinguish between the number 11 and the
string of two digits 1). All values in Tcl have a textual representation, and all commands can be specified in terms of their effects on the textual representation, so
checking whether your subroutines calculate what they are supposed to is straightforward: just type in the command, with explicit textual representations for its
argument, and see if the result is as you expected it to be.
Tcl can be used alone, but it is also easy to integrate with C. One side of this is that functions written in C can be wrapped up as Tcl commands; the interface
between the Tcl language and a user command implemented in C is similar to that between a command-line shell and system utility programs (such as grep), but
far more lightweight (no separate processes or context switches). Another side is that Tcl provides a library of C functions for handling composite values (data
structures), which handle many of the same needs as the standard C++ library does, even if with fewer bells and whistles. A classical C+Tcl development
paradigm is to first implement everything in Tcl (because it's much easier) and then reimplement in C those things which need to be faster; many programs have
fairly small performance-critical parts, if counting lines of code.
Specialised languages
Maple is a commercial Computer Algebra System developed by Waterloo Maple Inc. It is available for use in some MDH computer labs, but we
can't provide student licenses (though there have been a couple of cases where the supervisors really wanted that).
Mathematica is a commercial Computer Algebra System developed by Wolfram, Inc. (also providers of the wolframalpha web service). The
command language of that system is being rebranded as the general purpose Wolfram language, but adoption outside Mathematica itself has been
limited. Though programs can be written in a variety of styles, the language has a preference for the pattern-matching functional style. A
distinguishing feature is that programs can be actual mathematical formulae, e.g., the integration operation may be named ∫ (integral sign) rather
than really being some function Int that perhaps get prettyprinted as an integral sign (as is rather the case in most other CASes).
Matlab is a fairly basic dynamic language, with the distinguishing feature that "everything is a matrix" (or at least most things are matrices; strings are
for example 1×n matrices where element k holds the character code of the kth character in the string). But you've probably been subjected to Matlab
already if you're advanced enough in your studies to begin writing a thesis, as it is used in several courses at MDH.
Matlab can be quite efficient if you can make use of vectors and matrices to express iteration in your program, but ordinary loops are comparatively
slow. It also displays many flaws typical of specialised languages, where language designers only added general programming features as an
afterthought. One awkward trait is the rule that you need a separate source file for each subroutine in your program.
Finally, Matlab is one of those systems for which there exist lots and lots of libraries for doing all sorts of computations. Being commercial, the set
of libraries that are available may however vary quite a bit between different installations of Matlab; what works on an expensive premium
installation need not be available in a basic installation. This can be a problem if switching between university computers and your own private
computer.
Maxima is an open source/free Computer Algebra System. It is implemented in LISP, but provides a more mathematical command language
similar to that of Maple or Mathematica.
R is an open source/free programming language and software environment for statistical computing and graphics. It is also installed in most MDH
computer labs.
Unconventional languages
SQL is primarily a language for accessing databases. It can be surprisingly good at some
calculations, if one can figure out how to phrase them as a query of tables in a database, but
utterly useless for other things. SQL is rarely used as a stand-alone language, but very often to
encode operations on a database issued by a program primarily written in another language. SQL
has several known flaws (it was designed by a committee back in the 1970's), but it is fairly
intuitive to use (SQL statements are for example quite readable even if you only know English).
XSLT (abbreviation of eXtensible Stylesheet Language Transformations) was originally intended as
a mechanism for generating formatted renderings (think web pages) of structured data (stored
as an XML file), but for that it competes with many other technologies. On the other hand, it
turned out to be quite useful for certain kinds of operations on the data, particularly such
operations that make local transformations of the structure of the data — a description which
covers algebraic transformations of symbolic expressions. XSLT is somewhat of a Swiss army knife
in certain research communities, but is almost unknown in the mathematics mainstream.
Why are there so many programming languages?

evolution -- we've learned better ways of doing things over time

socio-economic factors: proprietary interests, commercial advantage

orientation toward special purposes

orientation toward special hardware

diverse ideas about what is pleasant to use


Importance of Programming Languages
 Programming language is the heart of software.

 Without programming we cannot make many applications and software.

 Programming Language is a key factor of software as well as embedded systems.

 Without programming language we cannot communicate with machines or systems. Systems only

know machine code. Machine codes mean some set of series of numbers.

 Humans only know high level languages but machines do not know high level languages.

 Humans and machine could not communicate directly.

 We need one intermediate because humans could not understand machine languages like machines

could not understand high level languages.


Why surveying programming Languages?
 Helps you choose a language.
C vs. Modula-3 vs. C++ for systemsprogramming
Fortran vs. APL vs.Ada for numerical computations
Ada vs. Modula-2 for embedded systems
Common Lisp vs. Scheme vs. MLfor symbolic data manipulation
Python vs R Vs Matlab for Data Science and Scientific programming
Java vs. C/CORBA for networked PCprograms

 Makes it easier to learn new languages some languages are similar; easy to walk
down family tree

 Helps you make better use of whatever language you use


Resource Material(s)
•S.O. Akinola , “Structured programming with Java”
•Java™ Programming Language, sun services
•Overview of Programming Languages - Mälardalen University Sweden

You might also like