1 / 18

CS C362 Programming Languages & Compiler Construction

CS C362 Programming Languages & Compiler Construction. Today’s Agenda. Course Perspectives Computing vs. Programming Programs Programming Languages Course Scope & Administrivia Coverage Projects / Tutorials. Course Perspectives. Computing vs. Programming

colton
Download Presentation

CS C362 Programming Languages & Compiler Construction

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS C362Programming Languages & Compiler Construction Sundar B., BITS, Pilani. TA C252

  2. Sundar B., BITS, Pilani. TA C252 Today’s Agenda Course Perspectives Computing vs. Programming Programs Programming Languages Course Scope & Administrivia Coverage Projects / Tutorials

  3. Sundar B., BITS, Pilani. TA C252 Course Perspectives Computing vs. Programming Programs capture “high level” computational behavior. (Contrast with a circuit) Programming – therefore – is an activity that deals with “high level” computational abstractions

  4. Sundar B., BITS, Pilani. TA C252 Course Perspectives [2] Computers vs. Programs They have independent existence. Algorithms since Euclid (??? B.C.) Difference between algorithm & program? Programs pre-date (at least digital) computers Church’s lambda calculus (1930’s) Church-Turing equivalence

  5. Sundar B., BITS, Pilani. TA C252 Programs [Course Perspectives] What is a program? Compare: Plan, Recipe, and Program. Plan: e.g. New Year Plans (stop postponing things, reduce TV time) e.g. Five Year Plans (generate 10 million jobs, increase tax revenue) Question: How is the plan implemented?

  6. Sundar B., BITS, Pilani. TA C252 Programs [2] [Course Perspectives] Recipe: E.g. Bisibela Bath: 1 cup rice, 1/3 cup dhal, 1 tablespoon coriander powder, 1 teaspoon chilli powder and a little turmeric; mix everything and add salt to taste; boil until the mixture is soft. Question: teaspoon vs. tablespoon? Whose taste? How soft? Question: What will be the result?

  7. Sundar B., BITS, Pilani. TA C252 Programs [3] [Course Perspectives] Plans are not (necessarily) feasible: No notion of execution or - as often - arbitrary notions of execution. Recipes are (often) feasible, but (as often) are ambiguous do not have predictable results are not (necessarily) repeatable: across time or persons.

  8. Sundar B., BITS, Pilani. TA C252 Programs [4] [Course Perspectives] Programs are specifications of solutions to problems. They are unambiguous. are formal (i.e., they are – at least, ought to be – constructed systematically out of basic steps) are executable (by a machine) have predictable and repeatable results. Claim A: “executable by machine” implies “repeatable and predictable”. (No Schrodinger’s cats!) Proof: By hand waving :-)

  9. Sundar B., BITS, Pilani. TA C252 Programs [5] [Course Perspectives] Definition: A program is a formal, unambiguous, and machine-executable specification of a solution to a problem.

  10. Sundar B., BITS, Pilani. TA C252 Programs [6] [Course Perspectives] Claim B: “executable by machine”  “formal and unambiguous”. Proof: By hand waving :-) Question: Does “formal and unambiguous” imply “executable by machine”? Answer: [Not so obvious but yes]

  11. Sundar B., BITS, Pilani. TA C252 Programs [7] [Course Perspectives] Claim C: “formal and unambiguous” “executable by machine”. (Reasonable) Assumption: “basic steps are realizable in finite time using finite space”. This assumption is often referred to as “Turing-computablity” (i.e. executability by a Turing machine).

  12. Sundar B., BITS, Pilani. TA C252 Programs [8] [Course Perspectives] Alternative (equivalent) definitions of a Program: A formal and unambiguous specification of a solution to a problem. A machine-executable specification of a solution to a problem. We will often use these definitions interchangeably: It is a matter of perspective!

  13. Sundar B., BITS, Pilani. TA C252 Programming Languages [Course Perspectives] Programs are formal specifications Programming languages provide “the building blocks and the glues” to construct those specifications. Sizes and shapes of the building blocks as well as the nature of the glues vary from language to language. But the (usual) goal – in language design – is “Turing computability”. The unusual languages are often domain-specific e.g. SQL, JSP/ASP, MS Excel macros

  14. Sundar B., BITS, Pilani. TA C252 Prog. Languages [2] [Course Perspectives] Church Turing Hypothesis: Anything “computable” is Turing-computable Turing Machine (TM) characteristics: States (control memory) State Transitions (instruction execution) Read/Write (Input/Output) Left/Right (Sequential Access)

  15. Sundar B., BITS, Pilani. TA C252 Prog. Languages [3] [Course Perspectives] Random Access Machine (RAM) is equivalent to TM: Random access can be simulated by a counting/address tape Instruction execution is nothing but state transition So, by Church-Turing hypothesis Anything “computable” is RAM-computable

  16. Sundar B., BITS, Pilani. TA C252 Prog. Languages [4] [Course Perspectives] Any common Instruction Set Architecture (say, x86 ISA) is an abstract form of RAM So, by Church-Turing hypothesis Anything “computable” is x86-ISA-computable A programming language (say C) is just an abstract form of ISA: Loops/conditionals can be simulated using jumps. All data values can be converted into binary forms. So, by Church-Turing hypothesis Anything “computable” is C-computable

  17. Sundar B., BITS, Pilani. TA C252 Prog. Languages [5] [Course Perspectives] There is more to languages (than just building blocks and glues): The building blocks and glues have (often deep) conceptual foundations They are not (at least ought not to be) kitchen sinks – they have an internal structure by themselves. The product(s) that are made out of them are live (assuming programs do run!)

  18. Sundar B., BITS, Pilani. TA C252 Course Scope • Course coverage will include: • Select Features of (widely used) languages • Brief insights into Programming (Lang.) Paradigms • Theoretical Foundations • Implementation of features (Compilers)

More Related