PROGRAMMING LANGUAGES
Dec 25, 2015
Programming Languages
– Coding schemes used to write both systems and application software
• A programming language is an abstraction mechanism. It enables a programmer to specify a computation abstractly, and to let a program (usually called an assembler, compiler or interpreter) implement the specification in the detailed form needed for execution on a computer
• To build programs, people use languages that are similar to human language. The results are translated into machine code, which computers understand.
• Programming languages fall into three broad categories
Machine languages
Assembly languages
Higher-level languages
Categories of Programming Languages
• Machine Language– 1st generation programming language– Considered a low-level language because it involves basic coding using
the binary symbols 1 and 0
• Machine languages (first-generation languages) are the most basic type of computer languages, consisting of strings of numbers the computer's hardware can use.
• Different types of hardware use different machine code. For example, IBM computers use different machine language than Apple computers
• Assembly Language– 2nd generation language– Replaced binary digits with mnemonics (e.g., “ADD”) programmers could more easily
understand
• Assembly languages (second-generation languages) are only somewhat easier to work with than machine languages.
• To create programs in assembly language, developers use cryptic English-like phrases to represent strings of numbers.
• The code is then translated into object code, using a translator called an assembler.
Categories of Programming Languages
• Higher-level languages are more powerful than assembly language and allow the programmer to work in a more English-like environment.
• Higher-level programming languages are divided into three "generations," each more powerful than the last• Third-generation languages
• Fourth-generation languages
• Fifth-generation languages
Categories of Programming Languages
• Third Generation Languages– Continued trend to more symbolic code (e.g. COBOL)
• Third-generation languages (3GLs) are the first to use true English-like phrasing, making them easier to use than previous languages.
• 3GLs are portable, meaning the object code created for one type of system can be translated for use on a different type of system.
• The following languages are 3GLs
• FORTAN C• COBOL C++• BASIC Java• Pascal ActiveX
Categories of Programming Languages
• Fourth Generation Languages (4GLs)– Languages that are less procedural and even more English-like than third-
generation languages (e.g. FOCUS)• Fourth-generation languages (4GLs) are even easier to use than 3GLs.
• 4GLs may use a text-based environment (like a 3GL) or may allow the programmer to work in a visual environment, using graphical tools.
• The following languages are 4GLs
Visual Basic (VB) Visual Age Authoring environments
Categories of Programming Languages
• 5th generation languages
– Combines rule-based code generation, component management, visual programming techniques, and reuse management
– Knowledge-based management• An approach to the development of computer programs in which you do not tell a
computer how to do a job, but what you want it to do• Fifth-generation languages (5GLs) are an issue of debate in the programming
community – some programmers cannot agree that they even exist.
• These high-level languages would use artificial intelligence to create software, making 5GLs extremely difficult to develop.
• Solve problems using constraints rather than algorithms, used in Artificial Intelligence• Prolog
Categories of Programming Languages
• Query languages– Used to ask the computer questions in English-like
sentences– Also known as database languages
• Structured query language (SQL)– A standardized language often used to perform
database queries and manipulations
Categories of Programming Languages
Object Oriented LanguagesLanguages that allow interaction of programming objects, including
data elements and the actions that will be performed on them• Note: OOP = object-oriented programming
• Object-oriented programming (OOP) is a method of structuring programs by identifying real world
• or other objects, and then writing modules each of which contains all the data and executable
• statements needed to represent one class of objects. Within such a module, there is a clear
• distinction between the abstract properties of the class which are exported for use by other objects,
• and the implementation which is hidden so that it can be modified without affecting the rest of the
• system.
Object Oriented Languages
• Encapsulation• The process of grouping items into an object
• Polymorphism• A process allowing the programmer to develop one routine or set
of activities that will operate on multiple objects
Object Oriented Languages
• Inheritance• Property used to describe objects in a group of objects taking on
characteristics of other objects in the same group or class of objects
• Reusable code• The instruction code within an object that can be reused in
different programs for a variety of applications
• Examples• Smalltalk, C++, Java
• C++, Objective-C, Smalltalk, Java, C#, Perl,Python, Ruby and
PHP are examples of object-oriented programming languages.
• The goals of object-oriented programming are
Increased understanding. Ease of maintenance. Ease of evolution.
Object Oriented Languages
Visual Programming Languages
– Languages that use a mouse, icons, or symbols on the screen and pull-down menus to develop programs
– Examples• Visual Basic• Visual C++• PC COBOL
Programming Languages: Terminology
• Language translator– Systems software that converts a programmer’s source
code into its equivalent in machine language
• Source code– High-level program code written by the programmer
• Object code– Another name for machine language code
Programming Languages: Terminology
• Interpreter– A language translator that translates one program
statement at a time into machine code
Programming Languages: Terminology
• Compiler– A language translator that converts a complete program
into machine language to produce a program that the computer can process in its entirety
Elements of Programming Languages
• Like ordinary languages, programming languages have syntax
• The syntax of a (programming) language is a set of rules that define what sequences of symbols are considered to be valid expressions (programs) in the language
• if-statement ::= if ( expression ) statement [ else statement ]
Hardware Description Language• Basic idea is a programming language to describe hardware
• Initial purpose was to allow abstract design and simulation– Design could be verified then implemented in hardware
• Now Synthesis tools allow direct implementation from HDL code.– Large improvement in designer productivity
• There are many different HDLs– Verilog HDL– ABEL– VHDL