ITEC 380 Organization of programming languages Dr. Andrew Ray.

Slides:



Advertisements
Similar presentations
Compilers Course 379K, TTH 9:30-11:00 Instructor: Dr. Doron A. Peled Office Hours: Mon 11:00-12:00.
Advertisements

CPSC 388 – Compiler Design and Construction
CS105 INTRODUCTION TO COMPUTER CONCEPTS INTRO TO PROGRAMMING Instructor: Cuong (Charlie) Pham.
Chapter3: Language Translation issues
Environments and Evaluation
Programming Languages Structure
CS 153: Concepts of Compiler Design August 25 Class Meeting Department of Computer Science San Jose State University Fall 2014 Instructor: Ron Mak
Summer 02-03Programming Language Concepts1 Programming Language Concepts (CS 360) Lecture 1: Overview, Grammars, and Little Languages Jeremy R. Johnson.
1.3 Executing Programs. How is Computer Code Transformed into an Executable? Interpreters Compilers Hybrid systems.
CS 415: Programming Languages Chapter 1 Aaron Bloomfield Fall 2005.
ITEC 352 Lecture 11 ISA - CPU. ISA (2) Review Questions? HW 2 due on Friday ISA –Machine language –Buses –Memory.
(1.1) COEN 171 Programming Languages Winter 2000 Ron Danielson.
CIS Computer Programming Logic
INTRODUCTION TO COMPUTING CHAPTER NO. 06. Compilers and Language Translation Introduction The Compilation Process Phase 1 – Lexical Analysis Phase 2 –
CS 153: Concepts of Compiler Design August 24 Class Meeting Department of Computer Science San Jose State University Fall 2015 Instructor: Ron Mak
Chapter 1. Introduction.
1 Week 4 Questions / Concerns Comments about Lab1 What’s due: Lab1 check off this week (see schedule) Homework #3 due Wednesday (Define grammar for your.
OPERATING SYSTEMS AND LANGUAGE TRANSLATORS CIS 2380 TERM 2 – LANGUAGE TRANSLATORS Lee McCluskey – 23/09/20151.
Chapter 1 Introduction Dr. Frank Lee. 1.1 Why Study Compiler? To write more efficient code in a high-level language To provide solid foundation in parsing.
1 Programming Languages Tevfik Koşar Lecture - II January 19 th, 2006.
LANGUAGE TRANSLATORS: WEEK 24 TRANSLATION TO ‘INTERMEDIATE’ CODE (overview) Labs this week: Tutorial Exercises on Code Generation.
CSC 338: Compiler design and implementation
Compiler course 1. Introduction. Outline Scope of the course Disciplines involved in it Abstract view for a compiler Front-end and back-end tasks Modules.
1 COMP 3438 – Part II-Lecture 1: Overview of Compiler Design Dr. Zili Shao Department of Computing The Hong Kong Polytechnic Univ.
Elements of Computing Systems, Nisan & Schocken, MIT Press, 2005, Chapter 11: Compiler II: Code Generation slide 1www.idc.ac.il/tecs.
Interpretation Environments and Evaluation. CS 354 Spring Translation Stages Lexical analysis (scanning) Parsing –Recognizing –Building parse tree.
Unit-1 Introduction Prepared by: Prof. Harish I Rathod
1.  10% Assignments/ class participation  10% Pop Quizzes  05% Attendance  25% Mid Term  50% Final Term 2.
COP 4620 / 5625 Programming Language Translation / Compiler Writing Fall 2003 Lecture 1, 08/28/03 Prof. Roy Levow.
1. 2 Preface In the time since the 1986 edition of this book, the world of compiler design has changed significantly 3.
Introduction Lecture 1 Wed, Jan 12, The Stages of Compilation Lexical analysis. Syntactic analysis. Semantic analysis. Intermediate code generation.
Introduction to Compilers. Related Area Programming languages Machine architecture Language theory Algorithms Data structures Operating systems Software.
Topic #1: Introduction EE 456 – Compiling Techniques Prof. Carl Sable Fall 2003.
1 Compiler Construction (CS-636) Muhammad Bilal Bashir UIIT, Rawalpindi.
1 Compiler Design (40-414)  Main Text Book: Compilers: Principles, Techniques & Tools, 2 nd ed., Aho, Lam, Sethi, and Ullman, 2007  Evaluation:  Midterm.
Chapter 1 Introduction Study Goals: Master: the phases of a compiler Understand: what is a compiler Know: interpreter,compiler structure.
Chapter 1 Introduction Major Data Structures in Compiler
Programming Languages
Compiler Design Introduction 1. 2 Course Outline Introduction to Compiling Lexical Analysis Syntax Analysis –Context Free Grammars –Top-Down Parsing –Bottom-Up.
Compiler Introduction 1 Kavita Patel. Outlines 2  1.1 What Do Compilers Do?  1.2 The Structure of a Compiler  1.3 Compilation Process  1.4 Phases.
Chapter 1 Introduction. Chapter 1 -- Introduction2  Def: Compiler --  a program that translates a program written in a language like Pascal, C, PL/I,
Chapter 1: Introduction 1 Compiler Designs and Constructions Chapter 1: Introduction Objectives: Course Objectives Introduction Dr. Mohsen Chitsaz.
Compilers I CNS History Wires Wires Machine Language Machine Language FFBA FFBA No Translation necessary No Translation necessary Assembly Language.
CS412/413 Introduction to Compilers and Translators Spring ’99 Lecture 11: Functions and stack frames.
C H A P T E R T W O Linking Syntax And Semantics Programming Languages – Principles and Paradigms by Allen Tucker, Robert Noonan.
Compiler Construction CPCS302 Dr. Manal Abdulaziz.
Presented by : A best website designer company. Chapter 1 Introduction Prof Chung. 1.
Prologue Sung-Dong Kim, Dept. of Computer Engineering, Hansung University.
Objective of the course Understanding the fundamentals of the compilation technique Assist you in writing you own compiler (or any part of compiler)
Chapter 1. Introduction.
Compilers Principles, Techniques, & Tools Taught by Jing Zhang
Component 1.6.
Compiler Design (40-414) Main Text Book:
Why study programming languages?
Chapter 1 Introduction.
Introduction to Compiler Construction
Component 1.6.
PROGRAMMING LANGUAGES
Compiler Construction (CS-636)
Chapter 1 Introduction.
PROGRAMMING LANGUAGES
-by Nisarg Vasavada (Compiled*)
课程名 编译原理 Compiling Techniques
Compiler Lecture 1 CS510.
CS190/295 Programming in Python for Life Sciences: Lecture 1
CPSC 388 – Compiler Design and Construction
CSE401 Introduction to Compiler Construction
Compilers B V Sai Aravind (11CS10008).
Compilers Principles, Techniques, & Tools Taught by Jing Zhang
CS105 Introduction to Computer Concepts Intro to programming
Presentation transcript:

ITEC 380 Organization of programming languages Dr. Andrew Ray

Introduction Objectives Introductions (Me + You) Outline of course Why study languages? Paradigms How languages are understood

Introduction Me 6 th year here at RU 1 st time teaching this course Have used lessons from this type of course to help with –Research –Teaching

Introduction You What is one topic you’d really like to learn about concerning programming languages? What do you want to learn in this class? How interested are you in this class? (1- 10) Share with class

Introduction How? Synchronous component Study at your leisure lectures Self study / experimentation Homework assignments –Intro –Major project Adaptability –Online forums/chat/twitter?

Introduction Informatio n Course website – Demo

Introduction Outline of course Languages 3-6 – Functional programming 7-10 – Logical programming – Procedural programming – OO / Review

Introduction Paradigms Radically different methods of accomplishing the same task Procedural Object oriented Functional Logical

Introduction Example Quicksort in haskell quicksort :: Ord a => [a] -> [a] quicksort [] = [] quicksort (p:xs) = (quicksort lesser) ++ [p] ++ (quicksort greater) where lesser = filter (< p) xs greater = filter (>= p) xs

Introduction Example void qsort(int a[], int lo, int hi) { int h, l, p, t; if (lo < hi) { l = lo; h = hi; p = a[hi]; do { while ((l < h) && (a[l] <= p)) l = l+1; while ((h > l) && (a[h] >= p)) h = h-1; if (l < h) { t = a[l]; a[l] = a[h]; a[h] = t; } } while (l < h); a[hi] = a[l]; a[l] = p; qsort( a, lo, l-1 ); qsort( a, l+1, hi ); }

Introduction Paradigms Right tool right job OO is probably used for > 95% of software development Purpose –Performance –Reliability –Elegance –Expression

Introduction Choose your language You are familiar with OO and procedural languages Goal: Not a rehash of Java / Ada Desire: Choose a different OO & procedural language to study for the course Thoughts?

Introduction Language s What is the purpose of a language? Why are there multiple languages? What are the major components of languages?

Introduction Computers Syntax –Did you put the exact number of ;’s in it? Semantics –What does it mean? Goal –Tell the computer what to do

Introduction Implementatio n Compilation –Source, translation to binary, execution Interpretation –Source, intermediate program, execution Benefits / downsides

Introduction History Dr. Okie’s history notes – l4.html

Introduction Compilers How a language is understood (ears / brain) Lexical analysis Syntactic Analysis Intermediate code generation Optimization Code Generation All use a central DB to store info (symbol table)

Introduction Symbol table Keystore method –Variables Type, value, scope, memory location –Functions –Classes Put info into table Pull it out when generating code

Introduction Stage 1 Read the information Start at the top left and read a character at a time When you hit whitespace/eos, generate token Hand token off Repeat What tokens come from x = 12 + y * 34?

Introduction Token handling Parse tree –What happens to each token Token 1: x Token 2: = Token 3: 12 Token 4: + Token 5: y Token 6: * Token 7: 34 Token 8: ; Tree x = 12+ y *34

Introduction Code generation Use parse tree / symbol table Step 1 – Lookup y’s value Step 2 – Multiply, store temp Step 3 – Add 12 to temp, store in temp2 Step 4 – Assign temp2 to x Not difficult to generate assembly for this x = 12+ y *34

Introduction Optimizatio n How to make your code better Extremely difficult field Reorganization of information –Unrolling loops Reduce redundant information

Introduction Not universal Not every implementation follows these steps Linking result against existing code Targeting interpreter versus assembler

Introduction Review Major paradigms / history of languages Parts of a computer language How a language becomes real

Introduction Next week Grammar Variable types / bindings / lifetime