{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

324-lecture2 - Principles Principles of Programming...

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon
Principles of Programming Languages Lecture 2 Wael Aboulsaadat [email protected] http://portal.utoronto.ca/
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Administrative: Waivers Course waivers CGPA waivers Check with your department
Background image of page 2
Introduction to Logic Programming
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Logic Programming (LP) Evolution: Problem barb2right Algorithm barb2right Assembly Code barb2right Machine Code |----------- Assembler ------------------| |---- Imperative/functional Compiler/Interpreter --| |------------------ Logic Language Compiler/Interpreter ---------| E.g.: 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 it’s power. Popular LP languages: Prolog, SQL, Datalog
Background image of page 4
LP: introduction – cont’d cont’d 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? A program in a logic programming language consists of a set of 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 run-time system provides the control (!)
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
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 is allowed to borrow a book for up to 4 weeks and can borrow up to 10 books. The library has a staff of 4 employees (librarians). An employee would be interested to know if a book is borrowed or in the library premise, if a book is a borrowed, how is borrowing it and when will it return.
Background image of page 6
LP: LP: Library Software Case Study Library Software Case Study
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}