You are on page 1of 5

MODULE 1

Structure of Programming Languages & Compiler Design: Course Introduction

Introduction

One important practical objective for this course is to help you learn how to learn
programming languages. Inevitably, if you are to have a career in software engineering
work, you will have to learn new programming languages at various times.

One way to develop your ability to learn languages is simply to learn several of them.
Learning the first one is hard, the next one often not so hard and so on. After you've
learned several, you will feel that learning new ones is a snap: you just learn to cope with
some new syntax and you're set.

Another practical objective of this course is to help you learn how to be a better
programmer in whatever language you use. Often you will not be in a position to specify a
language of your choice. Nevertheless, with a broad background in the paradigms and
issues of programming languages you will be in a much better position to consider solutions
to programming problems in any particular language that you must use. For example, you
may find that a solution could easily be expressed using the facilities of some language
other than that specified. You may then be able to develop creative ways to use that
solution to guide you in working with the specified language.

With a broad knowledge of programming language concepts and issues, you should also be
in a good position to perform a critical evaluation of the strengths and weaknesses of
whatever language you are using. Using the strengths, you may find novel creative ways to
solve problems. Focussing on the weaknesses, you will be able to identify obstacles or
pitfalls in developing a solution and take appropriate measures to avoid them altogether or
reduce their impact.

Definition

A computer programming language is a language used to write computer programs, which


involve a computer performing some kind of computation or algorithm and possibly control
external devices such as printers, disk drives, robots, and so on. For
example PostScript programs are frequently created by another program to control a
computer printer or display. More generally, a programming language may describe
computation on some, possibly abstract, machine. It is generally accepted that a complete
specification for a programming language includes a description, possibly idealized, of a
machine or processor for that language. In most practical contexts, a programming
language involves a computer; consequently programming languages are usually defined
and studied this way. Programming languages differ from natural languages in that natural
languages are only used for interaction between people, while programming languages also
allow humans to communicate instructions to machines.

Week 1
MODULE 1
Structure of Programming Languages & Compiler Design: Course Introduction

Short History of Programming Languages

A programming language is a set of words, codes, and symbols that allow a


programmer to give instructions to the computer. Many programming languages exist, each
with their own rules, or syntax,
for writing these instructions.

Programming languages can be classified as low-level and highlevel languages. Low-


level programming languages include machine language and assembly language. Machine
language, which is referred to as a first generation programming language, can be used to
communicate directly with the computer. However, it is difficult to program in machine
language because the language consists of 0s and 1s to represent the status of a switch (0
for off and 1 for on). Assembly language uses the same instructions and structure as
machine language but the programmer is able to use meaningful names or abbreviations
instead of numbers. Assembly language is referred to as a second generation programming
language.

High-level programming languages, which are often referred to as third generation


programming languages (3GL), were first developed in the late 1950s. High-level
programming languages have English-like instructions and are easier to use than machine
language. High-level programming languages include Fortran, C, BASIC, COBOL, and
Pascal. In order for the computer to understand a program written in a high-level language,
programmers convert the source code into machine language using a compiler or an
interpreter. A compiler is a program that converts an entire program into machine code
before the program is executed. An interpreter translates and executes an instruction before
moving on to the next instruction in the program.

In the 1980s, object-oriented programming (OOP) evolved out of the need to better
develop complex programs in a systematic, organized approach. The OOP approach allows
programmers to create modules that can be used over and over again in a variety of
programs. These modules contain code called classes, which group related data and actions.
Properly designed classes encapsulate data to hide the implementation details, are versatile
enough to be extended through inheritance, and give the programmer options through
polymorphism. Object-oriented languages include Java, C++ and Visual Basic.

Programming Domains
Defines a specific kind of use for a programming language.

• Scientific applications
– In the early 40s computers were invented for scientific applications.
– The applications require large number of floating point computations.
– Fortran was the first language developed scientific applications.
– ALGOL 60 was intended for the same use.
• Business applications
– The first successful language for business was COBOL.
– Produce reports, use decimal arithmetic numbers and characters.
– The arrival of PCs started new ways for businesses to use computers.
– Spreadsheets and database systems were developed for business.
• Artificial intelligence
– Symbolic rather than numeric computations are manipulated.

Week 1
MODULE 1
Structure of Programming Languages & Compiler Design: Course Introduction

– Symbolic computation is more suitably done with linked lists than arrays.
– LISP was the first widely used AI programming language.
• Systems programming
– The O/S and all of the programming supports tools are collectively known as
its system software.
– Need efficiency because of continuous use.
• Scripting languages
– Put a list of commands, called a script, in a file to be executed.
– PHP is a scripting language used on Web server systems. Its code is
embedded in HTML documents. The code is interpreted on the server before
the document is sent to a requesting browser.

Reasons for Studying Concepts of Programming Languages

• Improved background for choosing appropriate languages


• Many programmers, when given a choice of languages for a new project,
continue to use the language with which they are most familiar, even if it is
poorly suited to new projects.
• If these programmers were familiar with other languages available, they
would be in a better position to make informed language choices.
• Greater ability to learn new languages
• Programming languages are still in a state of continuous evolution, which
means continuous learning is essential.
• Programmers who understand the concept of OOP will have easier time
learning Java.
• Once a thorough understanding of the fundamental concepts of languages is
acquired, it becomes easier to see how concepts are incorporated into the
design of the language being learned.
• Understand significance of implementation
• Understanding of implementation issues leads to an understanding of why
languages are designed the way they are.
• This in turn leads to the ability to use a language more intelligently, as it was
designed to be used.
• Ability to design new languages
• The more languages you gain knowledge of, the better understanding of
programming languages concepts you understand.
• Overall advancement of computing

• In some cases, a language became widely used, at least in part, b/c those in
positions to choose languages were not sufficiently familiar with P/L concepts.
• Many believe that ALGOL 60 was a better language than Fortran; however,
Fortran was most widely used. It is attributed to the fact that the
programmers and managers didn’t understand the conceptual design of
ALGOL 60.
• Do you think IBM has something to do with it?

Week 1
MODULE 1
Structure of Programming Languages & Compiler Design: Course Introduction

Language Evaluation Criteria

The most important criteria for judging a programming language are:

1. Readability – The ease with which programs can be read and understood is called
readability. The following describe characteristics that contribute to the readability of
a PL.
a. Simplicity – The language that has large number of basic components is
more difficult to learn than one with small number of basic components.
b. Orthogonal – It means that a relatively small number of primitive
constructs can be combined in a number of ways to build the program.
c. Control Statements – A program that can be read from top to bottom is
much easier to understand than a program that requires the reader to
jump from one statement to some other non adjacent statement.
d. Data Types and Structures – The presence of adequate facilities for
defining data types and data structures in a language is another
significant aid to readability
e. Syntax Considerations – Syntax is the form of elements of language.

2. Writability – The measure of how easily a language can be used to create programs
for a chosen problem domain.
3. Reliability – A program is said to be reliable if it performs to its specifications under
all conditions. Along with all the features that affect readability and writability there
are several other features that affect reliability.
a. Type Checking – It is the testing for type errors in a given program either
by compiler or during program execution.
Ex:
1. Countless Loops
2. Formal and actual parameters being of different types
3. Array out of bounds

b. Exception Handling – The ability of a program to intercept run-time errors,


take corrective measures and then continue is a great aid to reliability.

4. Cost – The ultimate cost of a programming language is a function of many of its


characteristics.
a. The cost of training programmers
b. The cost of writing programs
c. The cost of compiling programs
d. The cost of executing programs
e. The cost of Language implementation System
f. The cost of poor reliability
g. The cost of maintaining program.

Programming Environments

A programming environment is the collections of tools used in the development of software.


This collection may consist of only a file system, a text editor, a linker, and a compiler. Or it
may include a large collection of integrated tools, each accessed through a uniform user
interface.

Week 1
MODULE 1
Structure of Programming Languages & Compiler Design: Course Introduction

UNIX is an older programming environment, first distributed in the middle 1970s, built
around a portable time sharing operating system. UNIX is now often used through a
graphical interface that runs on top of UNIX. One example of such a graphical interface is
the Common Desktop Environment (CDE).

Borland C++ is a programming environment that runs on IBM-PC microcomputers system


and compatible clones. It provides an integrated compiler, editor, debugger, and file
system. One convenient feature of this kind of environment is that when the compiler
encounters a syntax error, it stops and switches to the editor, leaving the cursor at the
point in the source program where the error was detected.

Smalltalk is a language and an integrated programming environment, but the Smalltalk


programming environment is more elaborate than Borland C++. Smalltalk was the first
system to make use of a windowing system and a mouse pointing device to provide the user
with a uniform interface to all tools

The latest is the Microsoft Visual C++; this is a large and elaborate collection of software
development tools. All used through a windowed interface.

Assignment:
Search for different programming language. List as many as possible
Explain each definition and identify their specialities

Quiz:

Choose the preferred programming language in the different

Week 1

You might also like