What is Programming Language A language that is

  • Slides: 29
Download presentation
What is Programming Language? A language that is acceptable to computer system is called

What is Programming Language? A language that is acceptable to computer system is called as Computer Language or Programming Language l Prepared by Mrs. Deepa Mishra 1

Types of Programming Languages l l l Machine-Level Assembly-Level High-Level Prepared by Mrs. Deepa

Types of Programming Languages l l l Machine-Level Assembly-Level High-Level Prepared by Mrs. Deepa Mishra 2

Machine-Level Language l l l Only Lang understood by computer Consist of 0’s and

Machine-Level Language l l l Only Lang understood by computer Consist of 0’s and 1’s It has two part format l Opcode l It l tells computer what function to perform Operand l It tells where to find or store the data, or other instructions Prepared by Mrs. Deepa Mishra 3

Advantages & Disadvantages l Advantages l l Faster Execution Disadvantages l l Machine dependent

Advantages & Disadvantages l Advantages l l Faster Execution Disadvantages l l Machine dependent Difficult to program Error prone Difficult to modify Prepared by Mrs. Deepa Mishra 4

Assembly Language Designed in 1952 l Alphanumeric mnemonics codes instead of numeric codes for

Assembly Language Designed in 1952 l Alphanumeric mnemonics codes instead of numeric codes for instructions l Each line consists of 4 columns l [Label]<Opcode><Operand>[; comment] l Example Label Opcode Operand Comment BEGIN ADD A, B ; Add B to A l Prepared by Mrs. Deepa Mishra 5

Advantages & Disadvantages l Advantages l Easy to understand & use Easy to correct

Advantages & Disadvantages l Advantages l Easy to understand & use Easy to correct and locate errors Easy to modify l Disadvantages l l Machine dependent Knowledge of h/w required Prepared by Mrs. Deepa Mishra 6

Assembler l Definition: l Converts Assembly Lang program into it’s equivalent machine Lang program

Assembler l Definition: l Converts Assembly Lang program into it’s equivalent machine Lang program Input Assembly Lang Program Output Assembler Prepared by Mrs. Deepa Mishra Machine Lang Program or m/c code or object code 7

High-Level Languages l Overcome limitations of Low level Languages( Machine & Assembly Language) Prepared

High-Level Languages l Overcome limitations of Low level Languages( Machine & Assembly Language) Prepared by Mrs. Deepa Mishra 8

Compiler Translate high levele lang. instructions into m/c lang. instructions Input High-Level Lang Program/source

Compiler Translate high levele lang. instructions into m/c lang. instructions Input High-Level Lang Program/source program eg. Hello. c Output Compiler Prepared by Mrs. Deepa Mishra Machine Lang Program /object program eghello. exe 9

Interpreter l Translates statement-by-statement instruction into machine Lang & immediately executes resulting Machine Lang

Interpreter l Translates statement-by-statement instruction into machine Lang & immediately executes resulting Machine Lang instruction Source program Data Interpreter( Translates & Executes statement-by-statement) Result Fig. Role of Interpreter Prepared by Mrs. Deepa Mishra 10

Linker Source File 1 Source File 2 Source File 3 Compiler Object File 1

Linker Source File 1 Source File 2 Source File 3 Compiler Object File 1 Object File 2 Object File 3 Linker Program Library Executable Fig. Role of Linker Prepared by Mrs. Deepa Mishra 11

Loader l l l Loader is component of compiler Locates given program in offline

Loader l l l Loader is component of compiler Locates given program in offline storage Loads into main memory for execution Prepared by Mrs. Deepa Mishra 12

Advantages of High level Lang. l Machine Independent Easy to Learn and Use Less

Advantages of High level Lang. l Machine Independent Easy to Learn and Use Less Errors l Disadvantages l Lower Efficiency l l Prepared by Mrs. Deepa Mishra 13

FORTRAN l l l l l FORmula TRANslation. Designed for scientific and mathematical applications

FORTRAN l l l l l FORmula TRANslation. Designed for scientific and mathematical applications by scientists and engineers. Fortan is refered as scientific language First high level language, using first complier Algebra based language General purpose and procedural language Oldest HLL BY JOHN BACKUS Initial release of FORTAN is for IBM 704 contained 32 statement. American Standard Association (ANSI)formed a committee to develop FORTRAN Prepared by Mrs. Deepa Mishra 14

COBOL l l l l COmmon Business Oriented Language. Developed in 1959 (Conference on

COBOL l l l l COmmon Business Oriented Language. Developed in 1959 (Conference on Data System languages) Best File handling capability Typically used for business applications. It is Self documenting, truly connotative ie permits both long names (up to 30 characters) and word connector char (dashes) It has large set of class libraries offers object oriented features , visual programming languages. Integration with world wide web. Prepared by Mrs. Deepa Mishra 15

BASIC l l Beginner’s All-purpose Symbolic Instruction Code. Today, it is not used to

BASIC l l Beginner’s All-purpose Symbolic Instruction Code. Today, it is not used to develop the programs but used to teach fundamentals of programming Interpreted language BASIC allows Loops, input from keyboard, MENU driven application , Structured programming. Programme Structures REM PRINT END Example PRINT “ HELLO WORD” END l Prepared by Mrs. Deepa Mishra 16

Pascal Named after French philosopher and mathematician Blaise Pascal. ● It is imperative and

Pascal Named after French philosopher and mathematician Blaise Pascal. ● It is imperative and Procedural Programming language. ● It is strongly typed block structured programming language ● Start with keyword begin ● Teaching Lang. ● Platform independent ● Used for scientific computational appl. ● PASCAL Program : PROGRAM Hello. World; BEGIN WRITELN(“HELLOWORLD”); END ● Prepared by Mrs. Deepa Mishra 17

SNOBOL ● ● ● ● String Oriented And Symbolic Language It is a text

SNOBOL ● ● ● ● String Oriented And Symbolic Language It is a text string oriented languages, Oriented towards string data handling. It has the facility of pattern matching SNOBOL 4 has no type declaration and no restriction on data type so it is dynamically typed. Interpretive Language i. e compiler translates program into a notation that the interpreter can easily execute. Used as research tool rather than commercial application. Used for analysis of Literature and music. Computer experts use SNOBOL for database programme. Prepared by Mrs. Deepa Mishra 18

C l l l Developed at Bell Laboratories in the 1972 by Dennis Ritchie.

C l l l Developed at Bell Laboratories in the 1972 by Dennis Ritchie. Provides efficiency of assembly language while having third generation language features. Often used for system programs. UNIX is written in C. Easy to learn and use Rich set of in built functions Prepared by Mrs. Deepa Mishra 19

C++ Developed by Bjarne Stroupstrup in 1983 l It is C language with additional

C++ Developed by Bjarne Stroupstrup in 1983 l It is C language with additional features. l Object oriented language l Designed for Unix system l // title of the program //comment # include<iostream. h> Void main() { Cout<<“hello world”; } l Prepared by Mrs. Deepa Mishra 20

JAVA l l l l l Developed by Sun Microsystem in 1991 An object-oriented

JAVA l l l l l Developed by Sun Microsystem in 1991 An object-oriented language Platform independent Jvm is m/c dependent Java is complied into special machine code called byte code and because of byte code java does not perform as fast as c++. Applications Used to create WWW applets Used for cross platform application development to create network applications. Prepared by Mrs. Deepa Mishra 21

LISP ● ● ● LISt Processing Language based on lambda calculus. (Mathematical notation for

LISP ● ● ● LISt Processing Language based on lambda calculus. (Mathematical notation for expressing functions. ) Oldest HLL second to Fortran. Permit the use of recursion Used in AI research Prepared by Mrs. Deepa Mishra 22

MATLAB l l l MATrix LABoratory Possesses tools for building custom GUI Includes mathematical

MATLAB l l l MATrix LABoratory Possesses tools for building custom GUI Includes mathematical functions l l Linear algebra, Fourier analysis, numerical integration USE Image & signal processing It is also known as language of technical computation. In this C, C++, java or excel code can be integrated. 2 D & 3 D visualization options are given for better representation of results l Prepared by Mrs. Deepa Mishra 23

Octave (Gnu octave) • • • Open source free license software. Same as MATLAB.

Octave (Gnu octave) • • • Open source free license software. Same as MATLAB. All commands which work in MATLAB can be used in this software. ADVANTAGES Works on Windows as well as Linux. Can give 2 D & 3 D graphics views. DISADVANTAGES Newly arrived software so may contain bugs. Lack of proper support. Performance is not proved till now. Prepared by Mrs. Deepa Mishra 24

Scripting Lang l l l l A scripting language is a form of programming

Scripting Lang l l l l A scripting language is a form of programming language that is usually interpreted rather than compiled. Used for web development Examples: Javascript , vbscript, html etc Used for writing scripts Used to create GUI & forms in search engines, web based e-mail Eg: java script, VB script, ASP, JSP, perl, ruby, tcl, shell & python Prepared by Mrs. Deepa Mishra 25

Scripting languages Advantages • Easier to write code than in compiled lang. l Minimum

Scripting languages Advantages • Easier to write code than in compiled lang. l Minimum prog. Knowledge is required l Allow rapid development & can communicate easily with program written in other lang. l Editing & running scripting code is fast Limitation • More time required for interpretation. • Hard to debug as no development environment is available by default • All script. Lang. not supported by all system. • S. L are text based it is easy to modify & break by others Prepared by Mrs. Deepa Mishra 26

Characteristics of Good PL l l l l Portability –M/c independent Simple & readable.

Characteristics of Good PL l l l l Portability –M/c independent Simple & readable. Reliability Performance Reusability Modularity Structured programming Prepared by Mrs. Deepa Mishra 27

Selecting Language for Coding l l l l Selecting Lang out of many available

Selecting Language for Coding l l l l Selecting Lang out of many available Languages for coding an Application depending on following factors Nature of Application-if the application is O. S intensive go for C, C++. If app. Is O. S independent go for java Familiarity with Lang Ease of Learning Lang When developing wed page go for JSP. Execution Efficiency Prepared by Mrs. Deepa Mishra 28

Subprograms l Subroutine is a set of instructions that perform a specific task for

Subprograms l Subroutine is a set of instructions that perform a specific task for a main routine & transfer control back to main routine Addition(x, y) header //code to perform intended task Prepared by Mrs. Deepa Mishra body 29