Lecture on Programming Languages

Slides:



Advertisements
Similar presentations
1 Knowledge Representation Introduction KR and Logic.
Advertisements

Structures. Procedural (Imperative) Languages Procedural languages work on the basis of explicitly telling the computer ‘how to do something’; by using.
ICE1341 Programming Languages Spring 2005 Lecture #6 Lecture #6 In-Young Ko iko.AT. icu.ac.kr iko.AT. icu.ac.kr Information and Communications University.
Programming Languages and Paradigms
Introduction to Prolog, cont’d Lecturer: Xinming (Simon) Ou CIS 505: Programming Languages Fall 2010 Kansas State University 1.
Chapter 8 High-Level Programming Languages. 8-2 Chapter Goals Describe the translation process and distinguish between assembly, compilation, interpretation,
Formal Logic Mathematical Structures for Computer Science Chapter 1 Copyright © 2006 W.H. Freeman & Co.MSCS SlidesFormal Logic.
1 Programming for Engineers in Python Autumn Lecture 5: Object Oriented Programming.
Overview of Programming Paradigms
Inference and Resolution for Problem Solving
High-Level Programming Languages
Slides prepared by Rose Williams, Binghamton University Chapter 3 Flow of Control Loops in Java.
Programming Languages
Alternative Programming Paradigms
© The McGraw-Hill Companies, 2006 Chapter 7 Implementing classes.
Programming Paradigms Imperative programming Functional programming Logic programming Event-driven programming Object-oriented programming A programming.
CS1502 Formal Methods in Computer Science Lecture Notes 10 Resolution and Horn Sentences.
INFERENCE IN FIRST-ORDER LOGIC IES 503 ARTIFICIAL INTELLIGENCE İPEK SÜĞÜT.
PZ01A Programming Language design and Implementation -4th Edition Copyright©Prentice Hall, PZ01A -- Introduction Programming Language Design and.
DEDUCTIVE DATABASE.
Computer Architecture Computational Models Ola Flygt V ä xj ö University
Chapter 8 High-Level Programming Languages (modified by Erin Chambers)
Introduction Computer science is the discipline that seeks to build a scientific foundation for a variety of topics. Computer science provides the underpinnings.
Programming Paradigms
AS Computing Introduction to Programming. What is a Computer Program? A list of instructions that a computer must work through, in a logical sequence,
Flow of Control. 2 Control Structures Control structure: An instruction that determines the order in which other instructions in a program are executed.
1 Chapter 8 Inference and Resolution for Problem Solving.
Chapter 6 Programming Languages. © 2005 Pearson Addison-Wesley. All rights reserved 6-2 Chapter 6: Programming Languages 6.1 Historical Perspective 6.2.
Chapter 8 High-Level Programming Languages. 8-2 Chapter Goals Describe the translation process and distinguish between assembly, compilation, interpretation,
Chapter 6 Programming Languages (2) Introduction to CS 1 st Semester, 2015 Sanghyun Park.
Computer Programs and Programming Languages What are low-level languages and high-level languages? High-level language Low-level language Machine-dependent.
Chapter 6 Programming Languages © 2007 Pearson Addison-Wesley. All rights reserved.
Chapter 6 Programming Languages (1) Introduction to CS 1 st Semester, 2015 Sanghyun Park.
Programming Languages and Paradigms Imperative Programming.
Comp763: Modern Computer Games Using Constraint Logic Programming to Analyze the Chronology in a William Faulkner Story Jennifer BurgSheau-Dong Lang Irwin.
CS4026 Formal Models of Computation Part II The Logic Model Lecture 2 – Prolog: History and Introduction.
Copyright © 2015 Pearson Education, Inc. Chapter 6: Programming Languages.
Prolog Kyle Marcotte. Outline What is Prolog? Origins of Prolog (History) Basic Tutorial TEST!!! (sort of…actually not really at all) My example Why Prolog?
3.2 Semantics. 2 Semantics Attribute Grammars The Meanings of Programs: Semantics Sebesta Chapter 3.
Chapter 3 Part II Describing Syntax and Semantics.
Logic Programming Languages Session 13 Course : T Programming Language Concept Year : February 2011.
Chapter 8 High-Level Programming Languages. 2 Chapter Goals Describe the translation process and distinguish between assembly, compilation, interpretation,
Chapter 9 ProgrammingLanguages.  Describe the evolution of programming languages from machine language to high-level languages.  Understand how a program.
Programming Models/ Paradigms Chapter 5: Programming Languages.
Invitation to Computer Science, Java Version, Second Edition 1 Logic Programming Logic programming  Various facts are asserted to be true  On the basis.
C H A P T E R T H R E E Type Systems and Semantics Programming Languages – Principles and Paradigms by Allen Tucker, Robert Noonan.
In The Name Of Allah Lab 03 1Tahani Aldweesh. objectives Searching for the solution’s. Declaration. Query. Comments. Prolog Concepts. Unification. Disjunction.
Java Programming, Second Edition Chapter Three Using Methods, Classes, and Objects.
Review for Test 2 Chapters 5 (start at 5.4), 6.1, , 12, 13, 15.1, Python.
OCR A Level F453: High level languages Programming techniques a. identify a variety of programming paradigms (low-level, object- oriented,
Ch. 7 Programming Languages
Knowledge-Based Systems Chapter 17.
Developing Applications
Computer Programming.
Chapter 6: Programming Languages
Control Structures (Structured Programming) for controlling the procedural aspects of programming CS1110 – Kaminski.
What would be our focus ? Geometry deals with Declarative or “What is” knowledge. Computer Science deals with Imperative or “How to” knowledge 12/25/2018.
Chapter 6: Programming Languages
What would be our focus ? Geometry deals with Declarative or “What is” knowledge. Computer Science deals with Imperative or “How to” knowledge 2/23/2019.
Overview of Programming Paradigms
Flow of Control.
Control Structures (Structured Programming) for controlling the procedural aspects of programming CS1110 – Kaminski.
Some Programming Paradigms
Habib Ullah qamar Mscs(se)
Presentation transcript:

Lecture on Programming Languages Chapter#5

Programming Paradigms/Models Paradigm defines a model or way of programming We will discuss the following three paradigms Imperative/Procedural Paradigm Declarative Paradigm Object Oriented Paradigm

The evolution of programming paradigms

The composition of a typical imperative program or program unit

Procedural Units Local versus Global Variables Formal versus Actual Parameters Passing parameters by value versus reference Procedures versus Functions

The flow of control involving a procedure

Example of procedure written in C language

Executing the procedure Demo and passing parameters by value

Executing the procedure Demo and passing parameters by reference

Object Oriented Paradigm In this approach all real world things are considered as an object. Each object has a certain set of qualities/ attributes and each object can perform some job/method. Thus if I have an object CAR then Car has its color, engine#, make, model etc as attributes and its methods can be drive(), stop() etc Examples include C++, Java etc

Declarative Programming Approach It emphasizes the question “What is the problem?” rather than “What algorithm is required for solving the problem?” Here a general problem solving approach is developed that can solve a number of problems. These languages are difficult to design and are special purpose by nature PROLOG (Programming LOGic) is an example

Figure 6.25 Resolving the statements (P OR Q), (R OR ¬Q), ¬R, and ¬P

Declarative Programming Resolution: Combining two or more statements to produce a new statement (that is a logical consequence of the originals). Example: (P OR Q) AND (R OR Q) resolves to (P OR R) Resolvent: A new statement deduced by resolution Clause form: A statement whose elementary components are connected by the Boolean operation OR Unification: Assigning a value to a variable so that two statements become “compatible.”

Prolog Fact: A Prolog statement establishing a fact Consists of a single predicate Form: predicateName(arguments). Example: parent(bill, mary). Rule: A Prolog statement establishing a general rule Form: conclusion :- premise. :- means “if” Example: wise(X) :- old(X). Example: faster(X,Z) :- faster(X,Y), faster(Y,Z).