Download Course Administration, Translating Computer Languages | 198 314 and more Study notes Computer Science in PDF only on Docsity!
198:314 Principles of
Programming Languages
Spring 2008
Dr. Mark Core [email protected] Hill 490
Outline
- (^) Course administration
- (^) Course goals and content
- (^) Translating computer languages
- (^) A look ahead to formal languages
When the webpage is up
- (^) Read basic course information (rules, exam policy, grading …)
- (^) Keep up to date with course news
- (^) Download lecture notes
- (^) Review syllabus (important dates and readings)
- (^) Readings: Michael L. Scott, Programming Language Pragmatics, 2 nd Edition (2006)
- (^) Check homeworks and projects for assignments
- (^) Find important links
- (^) Read Academic Integrity Policy
- (^) Consult Language resources: websites on languages used in course
Course Goals
- (^) Learn language fundamentals
- (^) easier to pick up new languages
- (^) Learn languages in different categories
(e.g., logical, functional, scripting)
- (^) Study central computer science concepts
- (^) Formal languages
- (^) System programming (e.g., compiling, interpreting)
Syllabus
- (^) Formal languages (regular expressions and context free grammars)
- (^) Logic programming (Prolog)
- (^) Basic semantics
- (^) Functional programming (e.g., Scheme)
- (^) Parameter passing
- (^) Scripting languages (e.g., Python)
- (^) Types
- (^) Parallel programming
Elements of your Grade
- (^) Three programming projects: posted and
submitted electronically
- (^) Midterm exam
- (^) Final exam
- (^) Homework assignments
- (^) Lecture and recitation attendance and
participation
Translation
- (^) Compilation: translates high-level
language into a form that can be executed
by the machine
Source Program Compiler input target program output Scott, Chap. 1, pg. 13
- (^) Interpretation: translating and executing high-level language line by line
- (^) Most languages are processed with a mix of compilation and interpretation - Compiled: Fortran, C, C++ - Interpreted: Java, Scheme, Lisp, Prolog
Translation
source program input output Scott, Chap. 1, pg. 14 interpreter
Compilation
Scanner Parser Intermediate Code Generation Optimizer Code Generator raw text of source code tokens parse tree intermediate form (e.g., abstract syntax tree) modified intermediate form target language Scott text, Chap. 1.
Compilation In Detail
- (^) Tokens (“words” of the language)
- (^) e.g., “i”, “:=“, “i”, “-”, “j”
- (^) Parse/Syntax Tree := id (i) id (i) expr id (j)
term term
Compilation (Optimization)
- (^) “Front end” of compiler
- (^) analyzes source language, not specific to a particular machine
- (^) machine independent optimizations (e.g., moving a variable declaration out of a loop)
- (^) “Back end” of compiler
- (^) generates code for a specific machine, potentially can hook up to multiple front ends
- (^) machine dependent optimizations (e.g., moving instructions to compensate for delays)
Formal Languages
- (^) The theoretical backbone of scanning and
parsing
- (^) Subject of first set of in depth lectures
- (^) Readings to come from Chapter 2 of Scott
text (to be announced), may include
supplemental reading