1. A programming language is a set of rules that allows humans to communicate instructions to computers using words, symbols, and grammatical structures.
2. Programming languages can be classified based on their level of abstraction from machine language as well as their generation. Lower-level languages like machine code and assembly languages require detailed instructions while higher-level languages abstract away hardware details.
3. Common types of programming languages include imperative languages like C and Fortran which describe computations procedurally, declarative languages like Prolog which specify what to compute logically, and object-oriented languages like C++ and Java which support modeling real-world entities.
1. A programming language is a set of rules that allows humans to communicate instructions to computers using words, symbols, and grammatical structures.
2. Programming languages can be classified based on their level of abstraction from machine language as well as their generation. Lower-level languages like machine code and assembly languages require detailed instructions while higher-level languages abstract away hardware details.
3. Common types of programming languages include imperative languages like C and Fortran which describe computations procedurally, declarative languages like Prolog which specify what to compute logically, and object-oriented languages like C++ and Java which support modeling real-world entities.
1. A programming language is a set of rules that allows humans to communicate instructions to computers using words, symbols, and grammatical structures.
2. Programming languages can be classified based on their level of abstraction from machine language as well as their generation. Lower-level languages like machine code and assembly languages require detailed instructions while higher-level languages abstract away hardware details.
3. Common types of programming languages include imperative languages like C and Fortran which describe computations procedurally, declarative languages like Prolog which specify what to compute logically, and object-oriented languages like C++ and Java which support modeling real-world entities.
1. A programming language is a set of rules that allows humans to communicate instructions to computers using words, symbols, and grammatical structures.
2. Programming languages can be classified based on their level of abstraction from machine language as well as their generation. Lower-level languages like machine code and assembly languages require detailed instructions while higher-level languages abstract away hardware details.
3. Common types of programming languages include imperative languages like C and Fortran which describe computations procedurally, declarative languages like Prolog which specify what to compute logically, and object-oriented languages like C++ and Java which support modeling real-world entities.
that provides a way of telling a computer what operations to perform. • A programming language is a set of rules for communicating an algorithm What is a Programming Language • English is a natural language. It has words, symbols and grammatical rules. • A programming language also has words, symbols and rules of grammar. • The grammatical rules are called syntax. • Each programming language has a different set of syntax rules. Levels of Programming Languages High-level program class Triangle { ... float surface() return b*h/2; }
Low-level program LOAD r1,b
LOAD r2,h MUL r1,r2 DIV r1,#2 RET Executable Machine code 0001001001000101 0010010011101100 10101101001... What Are the Types of Programming Languages • First Generation Languages • Second Generation Languages • Third Generation Languages • Fourth Generation Languages • Fifth Generation Languages First Generation Languages • Machine language – Operation code – such as addition or subtraction. – Operands – that identify the data to be processed. – Machine language is machine dependent as it is the only language the computer can understand. – Very efficient code but very difficult to write. Second Generation Languages • Assembly languages – Symbolic operation codes replaced binary operation codes. – Assembly language programs needed to be “assembled” for execution by the computer. Each assembly language instruction is translated into one machine language instruction. – Very efficient code and easier to write. Third Generation Languages • Closer to English but included simple mathematical notation. – Programs written in source code which must be translated into machine language programs called object code. – The translation of source code to object code is accomplished by a machine language system program called a compiler. Third Generation Languages (cont’d.) • Alternative to compilation is interpretation which is accomplished by a system program called an interpreter. • Common third generation languages – FORTRAN – COBOL – C and C++ – Visual Basic Fourth Generation Languages • A high level language (4GL) that requires fewer instructions to accomplish a task than a third generation language. • Scripting languages such as SQL, Apple script, VBScript • Used with databases – Query languages – Report generators – Forms designers – Application generators Fifth Generation Languages • Declarative languages • Functional(?): Lisp, Scheme, SML – Also called applicative – Everything is a function • Logic: Prolog – Based on mathematical logic – Rule- or Constraint-based History of Programming Languages Visual Basic IDE Integrated Development Environments • Source-code editor • Source-code management • Compiler • Interactive debugger Visual C++ IDE Four types of programming languages • Functional – Lisp, Scheme – Good for evaluating expressions. • Declarative – Prolog – Good for making logical inferences. • Imperative – C, Pascal, Fortran, COBOL – Good at performing calculations, implementing algorithms. • Object-oriented – C++, Java, C#, Visual Basic – Much like imperative languages, but have support for “communication” among objects. Imperative programming • Describes the details of HOW the results are to be obtained, in terms of the underlying machine model. • Describes computation in terms of – Statements that change a program state – Explicit control flow • Synonyms – Imperative programming – Operational • Fortran, C, … – Abstractions of typical machines – Control Flow Encapsulation • Control Structures • Procedures – No return values • Functions – Return one or more values • Recursion via stack Declarative Programming • Specifies WHAT is to be computed abstractly • Expresses the logic of a computation without describing its control flow • Declarative languages include – logic programming, and – functional programming. • often defined as any style of programming that is not imperative. Object-Oriented Concepts • Data Abstraction (specifies behavior) • Encapsulation (controls visibility of names) • Polymorphism (accommodates various implementations) • Inheritance (facilitates code reuse) • Modularity (relates to unit of compilation) Functional Programming • The design of the imperative languages is based directly on the von Neumann architecture – Efficiency is the primary concern, rather than the suitability of the language for software development • The design of the functional languages is based on mathematical functions – A solid theoretical basis that is also closer to the user, but relatively unconcerned with the architecture of the machines on which programs will run Mathematical Functions • A mathematical function is a mapping of members of one set, called the domain set, to another set, called the range set • A lambda expression specifies the parameter(s) and the mapping of a function in the following form (x) x * x * x for the function cube (x) = x * x * x Lambda Expressions • Lambda expressions describe nameless functions • Lambda expressions are applied to parameter(s) by placing the parameter(s) after the expression e.g., ((x) x * x * x)(2) which evaluates to 8