Taxonomy of Programming Languages CSCI 432 Computer Science

  • Slides: 15
Download presentation
Taxonomy of Programming Languages CSCI 432 Computer Science Theory

Taxonomy of Programming Languages CSCI 432 Computer Science Theory

Misc Notes We have been studying languages all semester. § Languages defined by Finite

Misc Notes We have been studying languages all semester. § Languages defined by Finite Automata § Regular Languages § etc

Importance of Types The syntax of a language is governed by the constraints that

Importance of Types The syntax of a language is governed by the constraints that define its data types. For example: ◦ everything in Java is a class ◦ most scripting languages use weak type checking

High Level v. Low Level Language: § eg, Assembly § every instruction is done

High Level v. Low Level Language: § eg, Assembly § every instruction is done by a piece of hardware § faster than compiled or interpreted High Level Language: § easier to code, manage, test, etc.

Compiled v. Interpreted Advantages of Compiled § the machine code in the. exe file

Compiled v. Interpreted Advantages of Compiled § the machine code in the. exe file runs fast § compiler probably optimizes your code Advantages of Interpreted § portable

Imperative Programming Languages English definition of "Imperative" - essential, authoritative command statements that change

Imperative Programming Languages English definition of "Imperative" - essential, authoritative command statements that change the machine's state § this is the majority of programming languages § some imperative languages have declarative properties § two subtypes § procedural § object-oriented

Components of Imperative Langs v Sequence o o how to control program flow from

Components of Imperative Langs v Sequence o o how to control program flow from one statement to the next eg blocks of code, procedures, functions, recursion v Selection o o making decisions eg if statements and case statements v Iteration o o repeating instructions eg for loops and while loops

Declarative Programming Languages specify what is to be done, not how to do it

Declarative Programming Languages specify what is to be done, not how to do it § does not specify control flow or order of operations § examples § HTML § SQL

Generations § 2 nd Generation Languages (2 GL) § Assembly § 3 rd Generation

Generations § 2 nd Generation Languages (2 GL) § Assembly § 3 rd Generation Languages (3 GL) § Higher level than 2 GL, like C and C++ § some 3 GLs, like Python, have libraries of routines that give them 4 GL characteristics

Generations § 4 th Generation Language (4 GL) § Operating on large collections of

Generations § 4 th Generation Language (4 GL) § Operating on large collections of data § for example: SQL, report writers § 5 th Generation Language (5 GL) § Problem solving based on constraints instead of algorithms § Artificial Intelligence programming § area of research for past 20 years, without significant progress § given a set of constraints, finding an algorithm to solve the problem is usually very difficult, thus usually requires a programmer (3 GL or 4 GL)

Domain Specific Languages as opposed to a General Purpose Language Examples: § HTML §

Domain Specific Languages as opposed to a General Purpose Language Examples: § HTML § statistical modeling languages § Open. GL shading language § software engineering - eg requirements specifications § shells - ls, ps, grep, sort, head, wc, …

Parallel Languages non-parallel a[]=b[]+c[] : for (i=0; i<size; i++) a[i] = b[i] + c[i];

Parallel Languages non-parallel a[]=b[]+c[] : for (i=0; i<size; i++) a[i] = b[i] + c[i]; Compiler and OS: forall (i=0; i<size; i++) a[i] = b[i] + c[i]; Programmer: function add (start, stop) { for (i=start; i<stop; i++) a[i] = b[i] + c[i]; } for (processor=0; processor<8; processor++) clone (processor, add(processor*size/8, (processor+1)*size/8));

FORTRAN and COBOL Example FORTRAN Code PROGRAM DEMO PRINT *, 'Enter number? ' READ

FORTRAN and COBOL Example FORTRAN Code PROGRAM DEMO PRINT *, 'Enter number? ' READ *, X IF (X. LE. 0) THEN PRINT *, 'That is negative. ' STOP END IF PRINT *, 'That is positive. ' STOP END

LISP q List Processing q Everything is a list ((Jimmy Carter), (Ronald Reagan), (George

LISP q List Processing q Everything is a list ((Jimmy Carter), (Ronald Reagan), (George Bush), ……. ) >(defun factorial (N) (if (= N 1) 1 (* N (factorial (- N 1))))) >(eval factorial(5)) (120)

CLIPS q known facts and rules that work on facts q logic programming language

CLIPS q known facts and rules that work on facts q logic programming language (assert (person (name Steve Dannelly) (occupation Professor) (home Rock Hill))) (facts) (defrule fire-emergency (type fire)) => (assert (response (action sprinkler-on))) )