1 / 9

Programming Languages 2nd edition Tucker and Noonan

Programming Languages 2nd edition Tucker and Noonan. Chapter 12 Imperative Programming I really hate this darn machine; I wish they would sell it; It won’t do what I want it to, but only what I tell it. Programmer’s lament (anonymous). Contents. 12.1 What Makes a Language Imperative?

Download Presentation

Programming Languages 2nd edition Tucker and Noonan

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Programming Languages2nd editionTucker and Noonan Chapter 12 Imperative Programming I really hate this darn machine; I wish they would sell it; It won’t do what I want it to, but only what I tell it. Programmer’s lament (anonymous)

  2. Contents 12.1 What Makes a Language Imperative? 12.2 Procedural Abstraction 12.3 Expressions and Assignment 12.4 Library Support for Data Structures 12.5 C 12.6 Ada 12.7 Perl

  3. Imperative Programming • Oldest and most well-developed paradigm • Mirrors computer architecture • Languages • Fortran, Pascal • C, Clite • Ada 83

  4. 12.1 What Makes a Language Imperative? • In a von Neumann machine memory holds: • Instructions • Data • Intellectual heart: assignment statement • Others: • Conditional branching • Unconditional branch (goto)

  5. Flowchart

  6. 12.2 Procedural Abstraction • Proceduralabstraction allows the programmer to be concerned mainly with a function interface, ignoring the details of how it is computed. • The process of stepwise refinement utilizes procedural abstraction to develop an algorithm starting with a general form and ending with an implementation. • Ex: sort(list, len)

  7. 12.3 Expressions and Assignment • Assignment statement is fundamental: • target = expression • Copy semantics: Expression is evaluated to a value, which is copied to the target; used by imperative languages • Reference semantics: Expression is evaluated to an object, whose pointer is copied to the target; used by object-oriented languages.

  8. There exist vast libraries of functions for most imperative languages. • Partially accounts for the longevity of languages like Fortran, Cobol, and C.

  9. Turing Complete • Integer variables, values, operations • Assignment • If • Goto • Re: Structured programming revolution of 1970s replace the goto with while loops.

More Related