Why study programming languages? • Increased capacity to express ideas – Constructs we can express can be constrained by the language we know • Improved background for choosing appropriate language – Should choose language appropriate for task not just the one that we know • Increased ability to learn new languages – Learning new languages and learning language fundamentals enables us to learn other languages more easily • Better understanding of the significance of implementation – Aids in finding bugs – Enables us to write more efficient code • Better use of languages that are already known – looking at the concept of languages (threads, exceptions, polymorphism) encourages uses of those things in languages already known (Java) • Overall advancement of computing – Educated people will encourage use of good languages Section 1.1 1 Computer Applications & Languages • Scientific – Number crunching, weather forecasting, codebreaking, plane/missile trajectories – Language requirements: • • • • Real numbers Large amount of calculations (hence efficient) Arrays, matrices Selection, Counting loops – Languages: • Assembly, Fortran, Algol and descendants of Algol (Pascal, Modula, Ada, PL/I) Section 1.2 2 Computer Applications & Languages • Scientific Applications – Language requirements: reals, efficiency, arrays, loops – Languages: Fortran, assembly, Algol • Business – Financial transactions – Language requirements: • Report production • Exact (but low) precision (e.g., money) • Character data – Languages: COBOL, RPG Section 1.2 3 Computer Applications & Languages • • Scientific Applications: reals, efficiency, arrays, loops Fortran, assembly, Algol Business Applications: reports, decimal precision, characters COBOL, RPG • Artificial Intelligence – Deductive systems, reasoning, machine learning – Language requirements: • Symbolic computation (“names” not numbers) • Lists of data (not arrays) • Recursion – Languages: LISP, Scheme, Prolog Section 1.2 4 Computer Applications & Languages • • • Scientific Applications: reals, efficiency, arrays, loops Fortran, assembly, Algol Business Applications: reports, decimal precision, characters COBOL, RPG AI Applications: Symbolic computation, Lists of data, Recursion LISP, Scheme, Prolog • Systems Programming – Operating systems, compilers, debuggers, etc. – Language requirements: • FAST execution • External device interfaces – Languages: C, Assembly Section 1.2 5 Computer Applications & Languages • • • • Scientific Applications: reals, efficiency, arrays, loops Fortran, assembly, Algol Business Applications: reports, decimal precision, characters COBOL, RPG AI Applications: Symbolic computation, Lists of data, Recursion LISP, Scheme, Prolog Systems Programming: fast, external devices C, Assembly • Web Software – Language requirements: dynamic web content, database access – Languages: XHTML, JavaScript, PHP, Ruby, Java Section 1.2 6 Language Influences • Architecture – von Neumann • Memory • CPU • ALU • Programming Methodologies – Unstructured – Procedure-oriented (top-down, functions, …) – Data-oriented (ADT, OO) Section 1.4 7 Language Categories (most important ones) • • • • Imperative Functional Logic Object oriented (extension of imperative) Section 1.5 8 Imperative Programming Languages • Central features are variables and assignment statements • Design based on the von Neumann architecture – Variables model memory cells – Assignment statement models the “piping operation” – operands piped from memory to CPU; result piped from CPU to memory Section 1.5 9 Functional Programming Languages • Main features are functions and function calls (recursion instead of iteration) • Design is based upon mathematical functions Section 1.5 10 Logic programming languages • Also called rule-based languages and declarative languages • Programmer gives rules that specify what a solution looks like and not how desired solution is achieved Section 1.5 11 Object Oriented Programming Languages • Provides a feature for building objects • Provides a method for specifying inheritance • Provides polymorphism – Same name for different functions (method overriding) – Dynamic binding of function call to function body Section 1.5 12 Implementation methods • Compilation • Interpretation • Hybrid Section 1.7 13 Compilation • Compiler translates program into machine language that is executed on the computer • Execution is fast Section 1.7 14 source Compilation machine code Lexical analyzer Syntax analyzer Optimizer Linker executable Semantic analyzer/ Intermediate code generation Code generator machine code Section 1.7 15 Interpreter • Pure interpretation means there is no translation of the source program • Program called an interpreter is executed by the computer • Interpreter fetches/decodes/executes source program • Slower and requires more space than the compilation process Section 1.7 16 Hybrid • Source program is translated into an intermediate code that is then interpreted • Examples – Java is translated into byte code that can be interpreted – Perl is compiled before execution in order to detect compilation errors (unlike shell languages) Section 1.7 17
© Copyright 2026 Paperzz