Programming Domains Course Summary
Programming Domains Course Summary
• Scientific applications
use of arrays –Fortran
• Business applications
– COBOL
• Artificial intelligence
– Symbols rather than numbers manipulated;
– LISP
• Systems programming
– C, C++
• Web Software
– Eclectic collection of languages: markup (e.g., HTML), scripting (e.g.,
PHP), general-purpose (e.g., Java)
Readability: the ease with which programs can be read and understood.
Writability: the ease with which a language can be used to create programs.
Reliability: A program is said to be reliable if it performs to its
specifications under all conditions.
Cost:the ultimate total cost
• Overall simplicity
–A manageable set of features and constructs
–Minimal feature multiplicity
–Minimal operator overloading
• Orthogonality
–A relatively small set of primitive constructs can be combined in a
relatively small number of ways
–Every possible combination is legal
• Data types
–Adequate predefined data types
• Syntax considerations
–Special words
Main characteristics that contribute to writability are(3):
1. Type checking
– Testing for type errors either in Compiling time or running time.
– Compile-time type checking is more desrible than run-time type checking
becanse it is expensive.
– the earlier errors in programs are detected, the less expensive it is
to make the required repairs.
– Example of type checking failure (subprogram parameter checking
problem in original C).
2. Exception handling
– Intercept run-time errors and take corrective measures.
– Ada, C++, Java, and C# support exception handling
3. Aliasing
- Aliasing means having two or more distinct names that can be used to
access the same memory cell.
– E.g (two pointers point to same memory loc in c++).
Computer Architecture
– Languages are developed around the prevalent computer architecture,
known as the von Neumann architecture
Program Design Methodologies
– New software development methodologies led to new programming
paradigms and by extension, new programming languages
• Program instructions often can be executed much faster than the speed
of the connection; the connection speed thus results in a bottleneck.
Language Categories:
Imperative
– Central features are variables, assignment statements, and iteration
– Include languages that support object-oriented programming
– Include scripting languages
– Include the visual languages “graphical user interface”
– Examples: C, Java, Perl, JavaScript, Visual BASIC .NET, C++
Functional
– Main means of making computations is by applying functions to given
parameters
– Examples: LISP, Scheme, ML, F#,……..etc • Logic
– Rule-based (rules are specified in no particular order)
– Example: Prolog
Markup/programming hybrid
– Markup languages extended to support some programming
– Examples: JSTL “Java Server Pages Standard Tag Library”, HTML, xTML
Language Design Trade-Offs
Implementation Methods
• Compilation
– Programs are translated into machine language; can be executed directly
on the computer
– Use: Large commercial applications
• Pure Interpretation
– Programs are interpreted by another program known as an interpreter
– Use: Small programs or when efficiency is not an issue
• Hybrid Implementation Systems
– A compromise between compilers and pure interpreters
– Use: Small and medium systems when efficiency is not the first concern
Compilation process
• Examples
– Perl programs are partially compiled to detect errors before
interpretation
– Initial implementations of Java were hybrid; the intermediate form,
byte code, provides portability to any machine that has a byte code
interpreter and a run-time system (together, these are called Java
Virtual Machine
Ch2:
Zuse’s Plankalkül
• Never implemented
• Advanced data structures
– floating point, arrays, records
– Designed for the new IBM 704, which had index registers and floating
point hardware
– Environment of development;
• Computers were small and unreliable
• Applications were scientific
• No programming methodology or tools
• Machine efficiency was the most important concern
Fortran I Overview
• First implemented version of Fortran
– Names could have up to six characters
– Post-test counting loop (DO)
– Formatted I/O
– User-defined subprograms
– Three-way selection statement (arithmetic IF)
– No data typing statements
ALGOL 58
• Names could be any length
• Arrays could have any number of subscripts
• Compound statements (begin ... end)
• Semicolon as a statement separator
• Assignment operator was :=
• if had an else-if clause
• No I/O
ALGOL 60 Overview
• New features
– Block structure (local scope)
– Two parameter passing methods
– Subprogram recursion
– Stack-dynamic arrays
– Still no I/O and no string handling
ALGOL 60 Evaluation
• Successes
– It was the standard way to publish algorithms for over 20 years
– All subsequent imperative languages are based on it
– First machine-independent language
– First language whose syntax was formally defined (BNF)
Pascal
• Designed for teaching structured programming
• Small, simple, nothing really new
• Largest impact was on teaching programming
C
• Designed for systems programming.
• Powerful set of operators, but poor type checking
• Initially spread through UNIX
• it Also has been used in many application areas
Java Evaluation
• Eliminated many unsafe features of C++.
• Supports concurrency “is the ability to run several programs or several
parts of a program in parallel”
• Libraries for GUIs, database access
• Portable: Java Virtual Machine concept (jvm), JIT compilers
• Widely used for Web programming
• Use increased faster than any previous language
Ch3;
Syntax: the form or structure of the expressions, statements, and program
units
Semantics: the meaning of the expressions, statements, and program units
Syntax and semantics: provide a language’s definition
Users of a language definition
• Other language designers • Implementers • Programmers (the users of the
language)
• A sentence is a string of characters over some alphabet.
• A language is a set of sentences.
• A lexeme is the lowest level syntactic unit of a language
• A token is a category of lexemes (e.g., identifier)
Describing syntax
• The strings of a language are called sentences or statements.
• programs are strings of lexemes rather than of characters.
• Lexemes are variable names, class, operators, numeric, and symbolic data.
• Each lexeme is belong to specific token.
• Token of a language is a category of its lexemes
•Context-Free Grammars
– Developed by Noam Chomsky
– Language generators, meant to describe the while syntax of natural
languages.
– Define a class of languages called context-free languages
• Backus-Naur
– Invented by John Backus to describe the syntax of Algol 58
– BNF is equivalent to context-free grammars
BNF Fundamentals
• BNF is a grammar consists of a finite set of rules.
• A rule has left-hand side (LHS), and right-hand side (RHS).
• Left-hand side (LHS), consists of a nonterminal symbol.
• Right-hand side (RHS), consists a string of terminals and/or
nonterminals. (definition of nonterminal symbol).
• Nonterminal is description of syntactic structure. enclosed with angle
brackets <>
• Terminals are lexemes or tokens, here is =.