CS 314: Principles of Programming Languages - Lecture 1, Study notes of Computer Science

The lecture notes for the first class of the course cs 314: principles of programming languages, held in summer 2008 at rutgers university. The notes cover the course goals, course administration, and the concept of translating computer languages. Students are introduced to the idea of being a multilingual programmer and the benefits of studying program translation. The document also includes information about course requirements, resources, and the syllabus.

Typology: Study notes

Pre 2010

Uploaded on 09/17/2009

koofers-user-ob7
koofers-user-ob7 🇺🇸

10 documents

1 / 21

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CS 314, Lecture 1 © MGCore 1
198:314 Principles of
Programming Languages
Summer 2008
Dr. Mark Core
mcore@rci.rutgers.edu
Hill 490
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15

Partial preview of the text

Download CS 314: Principles of Programming Languages - Lecture 1 and more Study notes Computer Science in PDF only on Docsity!

198:314 Principles of

Programming Languages

Summer 2008

Dr. Mark Core [email protected] Hill 490

Outline

  • (^) Course goals and content
  • (^) Course administration
  • (^) Translating computer languages

The Multilingual Programmer

  • (^) Different languages
    • (^) may be different sociologically (may be forced to use a particular language)
    • (^) support different ways of thinking about a problem
    • (^) have different functionality

Why Studying Program Translation?

  • (^) Be a better programmer
  • (^) Learn language fundamentals
    • (^) easier to pick up new languages
  • (^) Study central computer science concepts
    • (^) Formal languages
    • (^) System programming (e.g., compiling, interpreting)
  • (^) http://remus.rutgers.edu/cs314/sum2008/mco
  • (^) Announcements / Contact info / Office hours
  • (^) Links to
    • (^) Course information
    • (^) Syllabus / Copies of the lecture slides
    • (^) Homework and programming assignments
    • (^) Web resources for programming languages
    • (^) CS academic integrity policy

Course Webpage Resources

http://remus.rutgers.edu/cs314/sum2008/mcore/

  • (^) Keep up with Announcements on home page
  • (^) read course information (rules, exam policy, grading, etc.) and academic integrity information
  • (^) Syllabus / Copies of the lecture slides
    • (^) find readings for each lecture: Michael L. Scott, Programming Language Pragmatics, 2 nd Edition (2006)
    • (^) print slides before class as desired
  • (^) Consult pages for homework and programming assignments for details of your assignments
  • (^) Use web resources for programming languages for reference and learning basics of course languages

Tentative Grade Weighting

  • (^) Midterm exam - 25% (July 16)
  • (^) Final exam – 35% (August 13)
  • (^) Homework assignments / Lecture and

recitation attendance and participation –

  • (^) 2 programming projects: posted and

submitted electronically – 20%

What is a Programming Language?

  • (^) assembly/machine language: a means to

tell computer what to do

  • (^) higher-level languages: a means to

express an algorithm (to the computer as

well as other programmers)

“the art of programming is the art of organizing complexity” E. Dijkstra, 1972

How it works

  • (^) programs such as the OS must be in machine code to run
  • (^) why don’t we all program in machine code?
  • (^) not even alphanumeric, it’s binary
  • (^) very low level, reflects instructions that CPU can perform (e.g., load, store, add, compare, branch)
  • (^) so we invent alphanumeric languages supporting abstractions (e.g., for loops, objects)

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

Java Translation

Compiler (javac) intermediate code (bytecode) input Source Program (source.java) Interpreter a.k.a. Virtual Machine (java) output

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.

  • (^) Intermediate Code Generation
    • (^) replaces symbols such as variable names with references to symbol table
    • (^) removes abstract nodes in syntax tree
    • (^) can also produce other forms such as an abstract assembly-style language

Compilation In Detail (cont)

:= id (i) id (i) id (j)

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)