Download Organization off programming languages and more Lecture notes Computer Science in PDF only on Docsity!
ORGANIZATION OF
PROGRAMMING LANGUAGES
Class Overview
- Registration webpage:
- http://teaching.yfolajimi.com/register.html
- Class Web page
- http://teaching.yfolajimi.com/opl.html
- Lecture materials
- Textbooks:
- Concepts of Programming Languages by Robert Sebesta
- Programming languages, principles and paradigm by Allen Tucker and Robert Noonan
- Resources on the class webpage (slides, pdfs, videos etc)
- Papers, publications and other online resources
REASONS FOR STUDYING CONCEPTS OF
PROGRAMMING LANGUAGES
- Increased ability to express ideas/algorithms
- In Natural language, the depth at which people think is influenced by the expressive power of the language they use. In programming language, the complexity of the algorithms that people Implement is influenced by the set of constructs available in the programming Language
- Improved background for choosing appropriate Languages
- Many programmers use the language with which they are most familiar, even though poorly suited for their new project. It is ideal to use the most appropriate language.
- Increased ability to learn new languages
- For instance, knowing the concept s of object oriented programming OOP makes learning Java significantly easier and also, knowing the grammar of one’s native language makes it easier to learn another language.
- Better Understanding of Significance of implementation
- Better use of languages that are already known
- The overall advancement of computing
APPLICATION DOMAINS
Scientific Applications
2. Data processing Applications
3. Text processing Applications
4. Artificial intelligence Applications
5. Systems Programming Applications
6. Web software
DATA PROCESSING APPLICATIONS
• Those programming problems whose
predominant interest is in the creation,
maintenance, extraction and summarization
of data in records and files.
• Example:
• COBOL is a programming language that can be
used for data processing applications.
TEXT PROCESSING APPLICATIONS
• those whose principal activity involves the
manipulation of natural language text, rather
than numbers as their data. SNOBOL and C
language have strong text processing
capabilities
SYSTEMS PROGRAMMING
APPLICATIONS
- involve developing those programs that interface the
computer system ( the hardware) with the programmer
and the operator.
- These programs include compilers, assembles,
interpreters, input-output routines, program
management facilities and schedules for utilizing and
serving the various resources that comprise the
system.
- Examples:
- Ada and Modula – 2 are examples of programming
languages
WEB SOFTWARE
• collection of languages which include:
– Markup (e.g. XHTML)
– Scripting for dynamic content under which we
have the
- Client side, using scripts embedded in the XHTML
documents e.g. Javascript, PHP
- Server side, using the common Gateway interface e.g.
JSP, ASP, PHP
– General- purpose, executed on the web server
through cGI e.g. Java, C++.
4. Modularity - Modularity has two aspects: the language’s support for sub- programming and the language’s extensibility in the sense of allowing programmer – defined operators and data types. By sub programming, we mean the ability to define independent procedures and functions (subprograms), and communicate via parameters or global variables with the invoking program. 5. Input-Output facilities - In evaluating a language’s “Input-Output facilities” we are looking at its support for sequential, indexed, and random access files, as well as its support for database and information retrieval functions 6. Portability - A language which has “portability” is one which is implemented on a variety of computers. That is, its design is relatively”machine – independent”. Languages which are well- defined tend to be more portable than others.
CRITERIA FOR LANGUAGE EVALUATION AND COMPARISION
7. Efficiency - An “efficient” language is one which permits fast compilation and execution on the machines where it is implemented. Traditionally, FORTRAN and COBOL have been relatively efficient languages in their respective application areas. 8. Pedagogy - Some languages have better “pedagogy” than others. That is, they are intrinsically easier to teach and to learn, they have better textbooks; they are implemented in a better program development environment, they are widely known and used by the best programmers in an application area. 9. Generality - This means that a language is useful in a wide range of programming applications. For instance, APL has been used in mathematical applications involving matrix algebra and in business applications as well.
CRITERIA FOR LANGUAGE EVALUATION AND COMPARISION
LANGUAGE PARADIGMS (Developments in Programming Methodology)
1. Imperative - This is designed around the Von Neumann architecture. Computation is performed through statements that change a program’s state. Central features are variables, assignment statements and iteration, sequency of commands, explicit state update via assignment. Examples of such languages are Fortran, Algol, Pascal, C/C++, Java, Perl, Javascript, Visual BASIC.NET. 2. Functional - Here, the main means of making computations is by applying functions to parameters. Examples are LISP, Scheme, ML, Haskell. It may also include OO (Object Oriented) concepts. 3. Logic - This is Rule-based (rules are specified in no particular order). Computations here are made through a logical inference process. Examples are PROLOG and CLIPS. This may also include OO concepts.
TRADE-OFFS IN LANGUAGE DESIGN
Reliability Vs. Cost of Execution:
- For example, Java demands that all references to array
elements be checked for proper indexing, which leads
to increased execution costs.
2. Readability vs. Writability: - APL provides many powerful operators land a large
number of new symbols), allowing complex
computations to be written in a compact program
but at the cost of poor readability.
3. Writability (Flexibility) vs. reliability: - The pointers in c++ for instance are powerful and very
flexible but are unreliable.
COMPILATION
• - Translated high level program (source language)
into machine code (machine language)
- Slow translation, fast execution
- Compilation process has several phases
- Lexical analysis converts characters in the source program into lexical units (e.g. identifiers, operators, keywords).
- Syntactic analysis: transforms lexical units into parse trees which represent the syntactic structure of the program.
- Semantics analysis check for errors hard to detect during syntactic analysis; generate intermediate code.
- Code generation – Machine code is generated
INTERPRETATION
- Easier implementation of programs (run-time errors can easily and
immediately be displayed).
- Slower execution (10 to 100 times slower than compiled programs)
- Often requires more memory space and is now rare3 for traditional
highlevel languages.
- Significant comeback with some Web scripting languages like PHP and
JavaScript.
- Interpreters usually implement as a read-eval-print loop:
- Read expression in the input language (usually translating it in some internal form)
- Evaluates the internal forms of the expression
- Print the result of the evaluation
- Loops and reads the next input expression until exit
- Interpreters act as a virtual machine for the source language:
- Fetch execute cycle replaced by the read-eval-print loop
- Usually has a core component, called the interpreter “run-time” that is a compile program running on the native machine.