This preview shows pages 1–7. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Principles of Programming Languages Principles of Programming Languages Lecture 2 Lecture 2 Wael Aboulsaadat Wael Aboulsaadat wael@cs.toronto.edu wael@cs.toronto.edu http://portal.utoronto.ca/ Administrative: Waivers Administrative: Waivers Course waivers CGPA waivers Check with your department Introduction to Logic Programming Logic Programming (LP) Logic Programming (LP) Evolution: Problem b Algorithm b Assembly Code b Machine Code  Assembler  Imperative/functional Compiler/Interpreter  Logic Language Compiler/Interpreter E.g.: ind X and Y such that 3 X + 2 Y = 1 and X = 4 Find X and Y such that 3 X + 2 Y = 1 and X Y = 4 Retrieve the telephone number of the person whose name is Tom Smith The value of X equals the value of Y + 3 Why LP? We can understand the meaning without knowing the state of the program A lot easier to say what , but not how . Direct manipulation of symbolic structures gives us its power. Popular LP languages: Prolog, SQL, Datalog LP: introduction LP: introduction contd contd LP Characteristics: Not based on state modifications Not procedural in nature Does not have control flow ( as we are used to thinking of it ) So, what does it have? So, what does it have? A program in a logic programming language consists of a set of eclarations lated together using redicate calculus declarations related together using predicate calculus . An algorithm in a LP language = logic + control Logic: programmer provides the logic which is what the program does. Control: language runtime system provides the control (!) LP: LP: Library Software Case Study Library Software Case Study Problem Statement: The Eng & Comp Sci library is part of the University of Toronto libraries. You were contacted by the library to develop a software for managing book loans. The library has 15,000 titles serving 40,000 students. An undergraduate student is allowed to borrow a book for up to 2 weeks and can borrow up to 5 books at a time. A graduate student is2 weeks and can borrow up to 5 books at a time....
View
Full
Document
This document was uploaded on 08/02/2011.
 Spring '09
 C Programming

Click to edit the document details