Presentation is loading. Please wait.

Presentation is loading. Please wait.

The Role of Programming Languages Chapter 1: Programming Languages: Concepts and Constructs by Ravi Sethi.

Similar presentations


Presentation on theme: "The Role of Programming Languages Chapter 1: Programming Languages: Concepts and Constructs by Ravi Sethi."— Presentation transcript:

1 The Role of Programming Languages Chapter 1: Programming Languages: Concepts and Constructs by Ravi Sethi

2 What is a Programming Language? n a tool for instructing machines n a means of communicating between programmers n a vehicle for expressing high-level designs n a notation for algorithms n a way of expressing relationships between concepts n a tool for experimentation n a means for controlling computerized devices

3 Language Designers n Balance n … making computing convenient for programmers (a fool with a tool is still a fool) n and making efficient use of computing machines (... Why do I have to state this?)

4 Levels n Gross distinction between programming language n based on readability n based on independence n based on purpose (specific … general)

5 Levels n Machine level language n Assembly level language n High-level language (3GL) n sometimes 4GL - fourth Generation Language

6 Machine Level n 00000010101111001010 n 00000010101111001000 n 00000011001110101000 n Can you tell what this code fragment does? n Can it be executed on any machine? n Is it general purpose?

7 Assembly Language n Look at figure 1.1 n LD R1,”0” n LD R2, M n ST R2, R1 n … real assembly used mnemonics n Add A(M), …. Had to do your own indexing n What does this program do?

8 Assembly Language n Look at page 63 in your text and figure 3.1 n Can you understand what it does now?

9 Basic Concepts of a RAM machine n Memory: addresses, contents n Program: instructions n input/output:(files) 20 2000 A10 200A c A = 3 + c lvalue-> address rvalue->contents

10 High Level n Readable familiar notations n machine independence n availability of program libraries n consistency check (check data types)

11 Problems of Scale n Changes are easy to make n isolated program fragments can be understood n BUT… one small bug can lead to disaster n read the NOT story about Mariner rockets n Notice how the chairman does not understand that a “small” problem can lead to devastating result and why it was not caught

12 Bugs n Programming testing can be used to show the presence of bugs, but never their absence! n Dijkstra n Programming Languages can help n readable and understandable n organize such that parts can be understood

13 Role of Programming Languages n Art (science) of programming is organizing complexity n Must organize in such a way that our limited powers are sufficient to guarantee that the computation will establish the desired effect n (Dijkstra - structured programming, sometimes referred to as goto-less programming)

14 Programming Paradigms n Imperative - action oriented, sequence of actions n Functional - LISP, symbolic data processing n Object-Oriented n Logic - Prolog, logic reasoning n Sequential and concurrent

15 Language Implementation n Compiler - source code it translated into machine code (all at once) n Interpreter - machine is brought up to the language (one statement at a time)

16 Compiled C Source code in C Pre- procces sor compiler Linker or assembler Machine code (exe) Loader Machine codes.o files Pre processed code

17 Interpreted Code n Each instruction is interpreted by machine interpreter n does not produce object code

18 Comparisons n Compilation more efficient n interpreted more flexible

19 Testing your skill n Do 1.4 (a,b,c) in PL book n Do 1.5 n For each file, include a file header: u what this file accomplishes - description u what “entities” are in this file u dependencies u structure

20 Testing your skill n For each module, include a module header: u what this module accomplishes - description u dependencies ( parameters(in, out, inout), global data (accessed or modified), called by (fanin), calls (fanout) ) u restrictions u programmer u date created u modifications

21 Testing your skill n For the test cases, include a test header: u for each input, put the expected output, date executed, name of tester and passed/failed


Download ppt "The Role of Programming Languages Chapter 1: Programming Languages: Concepts and Constructs by Ravi Sethi."

Similar presentations


Ads by Google