Presentation on theme: "Programming Languages"— Presentation transcript:
1Programming Languages Dr. Shahriar BijaniSep. 2014
2Text BookKenneth C. Louden & Kenneth A. Lambert, Programming Languages: Principles and Practice, 3rd Edition, 2012.
3Code of Conduct Plagiarism is not acceptable! All assignments are strictly individualUnless explicitly stated otherwise
4Main Slide ReferencesCS 152: Programming Language Paradigms, Dept. of Computer Science, San Jose State University, Spring 2014.COMP313A: Programming Languages, Dept. of Computer Science, The University of Waikato,
5Goals of the Course Program in languages from different “cultures”. Learn new ideas and concepts.Apply the new concepts to your “native” language.C++, C#, Java, etc.Become a better programmer!Different programming cultures (paradigms).Object-orientedC++, C#, Objective C, Java, etc.FunctionalLisp, Scheme, ML, Haskell, F#LogicProlog
6Goals of the Course How are programming languages designed? Can we design a language?What are the design criteria?How can we specify the language’s syntax and semantics?What about data types and control structures?How are programming languages implemented?InterpretersCompilers
7Why This Course? Increased capacity to express ideas. The depth at which we can think is influenced by the expressive power of the languageImproved background for choosing appropriate languages.Make better informed choices if you are familiar with other available languages, especially the particular features of those languages.
8Why This Course? Increased capacity to learn new languages. Understanding of the fundamental concepts of languages and learning a new language give you better understanding of your first language.Better understanding language implementation.Understand implementation issues Understand why languages are designed the way they are Ability to use a language more intelligently.Increased ability to design new languages.Advance the state of the art.Better languages can crowd out poor languages.
9A Historic TimelineProgramming Languages: Principles and Practice, 3rd ed. Kenneth Louden & Kenneth Lambert(c) 2012 Course Technology. All rights reserved
10Origins of Programming Languages A programming language is often defined as “a notation for communicating to a computer what we want it to do”.Before the mid 1940s, computer operators set switches to adjust the internal wiring of a computer to perform the requested tasks.Programming languages allowed computer users to solve problems without having to reconfigure hardware.
11Plugboard Control Panel IBM 407 Accounting Machine (1949)
12Programming a Plugboard “Programming” was hand-wiring plugboards.“Hmm, should I pass this parameter by value or by reference?”
13Programming a Plugboard Plugboard wiring diagramIt doesn’t look too complicated, does it?
14Machine LanguageJohn von Neumann proposed that computers should be permanently hardwired with a small set of general-purpose operations.An operator could input a series of binary codes to organize the basic hardware operations to solve more specific problems.Operators could flip switches to enter these codes, called machine language, into memory.John von Neumann was a Hungarian and American pure and applied mathematician, physicist, inventor and polymath. He made major contributions to a number of fields, including mathematics, physics, economics, computing, and statistics.
15Machine LanguageMachine language programming was boring and error prone.
16Assembly LanguageAssembly language: a set of mnemonic symbols for instruction codes and memory locations.Example: LD R1,R2Assembler: a program that translates the symbolic assembly language code to binary machine code.Loader: a program that loads the machine code into computer memory for execution.Input devices:Keypunch machinePunched card reader
18Assembly LanguageMnemonic symbols were an improvement over binary machine codes but still had shortcomings.Lacks abstraction of conventional mathematical notation.Each type of computer hardware architecture has its own machine language instruction set and requires its own dialect of assembly language.Assembly languages first appeared in the 1950s and are still used today for low-level system tools or for hand-optimization.
19Punched CardsData was stored in punched cards called “IBM cards” or “Hollerith cards”Named after Herman Hollerith.80 columns per card, one character per column.Up to 12 punched holes per column.Alphanumeric data, often grouped into fields. _
20A Data Processing Job A typical “job”. Tanenbaum & Woodhull Operating Systems: Design and Implementation(c) 2006 Prentice-Hall, Inc. All rights reserved
21Punched Cards Data processing was all about punched cards. A compiler project!3½ boxes of punched cardsEach box = 2000 cards, 10 lbs.
22FORTRAN FORTRAN: FORmula TRANslation language Developed by John Backus in the early 1950s.Reflected the architecture of a particular type of machine.Lacked the structured control statements and data structures of later high-level languages.Popular with scientists and engineers for its support for algebraic notation and floating-point numbers.The language has evolved and is still used today.FORTRAN IVFORTRAN 77FORTRAN 90FORTRAN 95FORTRAN
23FORTRAN DOUBLE PRECISION NUMBER, ROOT C DO 500 I = 1, 3 5 WRITE (6, 10)10 FORMAT ('ENTER A NUMBER')READ (5,100) NUMBER100 FORMAT (F5.1)IF (NUMBER .GE. 0.0) GO TO 175WRITE (6, 150)150 FORMAT ('*** THE NUMBER MUST NOT BE NEGATIVE.')GOTO 5175 ROOT = DSQRT(NUMBER)WRITE (6,200) NUMBER, ROOT200 FORMAT ('THE SQUARE ROOT OF ', F5.1, ' IS ', F15.10)500 CONTINUEPAUSESTOPEND
24Algol Algol: Algorithmic Language released in 1960 Provided a standard notation for computer scientists to publish algorithms in journals.John Backus was a major contributor.Structured control statementsSequencing (begin-end blocks)Loops (for loop)Selection (if and if-else statements)Different numeric typesIntroduced the array structureSupported proceduresIncluding recursive procedures
25The Algol FamilyA large number of high-level languages descended from Algol, including:Pascal: language for teaching programming in the 1980sAda: for embedded applications of U.S. Dept. of Defense (DoD)Algol control structures are present in today’s languages, including Java, C, C++, etc.