Lecture content. Course goals. Course Introduction. TDDA69 Data and Program Structure Introduction Cyrille Berger

Size: px
Start display at page:

Download "Lecture content. Course goals. Course Introduction. TDDA69 Data and Program Structure Introduction Cyrille Berger"

Transcription

1 Lecture content TDDA69 Data and Program Structure Introduction Cyrille Berger Course Introduction Concepts and models of programming languages The different programming paradigms Why different paradigms? Introduction to KL 2 / 52 Course goals Course Introduction Describe aspects of evaluation and execution in different language models Explain and demonstrate how design choices affect the expressiveness and efficacy of a programming language Analyze and value programming languages based on their evaluation and compilation strategies Implement programming languages in the form of an interpreter and a compiler 4 / 52

2 Why should you care about this course? Programming languages are the key tools that define how we think about computations, and what we are able to create. It will help you understand why programming language works a certain way and what are the limits What you learn during this course will give you the power to learn, choose, and craft your tools effectively. In this course we will look at programming with a scientific eye. 5 / 52 Creative extension principle Why new language/new Existing language have limitations in expressiveness With increase in complexity of the features provided, the source code complexity increase, this can be solve with new programming concept 6 / 52 Example of creative extension principl Programming languages Without exception With exception General purposes: C, C++, Java, Python... Special purposes: Prolog, Matlab, R, Agent0... Scripting: JavaScript, VBA... Historical: Fortran, Lisp... 7 / 52 8 / 52

3 Evolution of programming languages How is a program interpreted? Source code Parser Parser Abstract Syntax Tree Tree visitor Generator Source code... Bytecode Virtual Machine Assembler Assembly Operating System CPU 9 / / 52 Facebook's work on the PHP intepreter Facebook started with PHP in 2004 Back at the time, PHP was the gold standard for website programming and prototyping But this is causing problems and for practical reasons they cannot change programming language 11 / 52 What did Facebook do? The standard PHP interpreter is using a virtual machine (Zend) They developed a tool to convert PHP to C++ Then they developed a new interpreter that do Just-In-Time (JIT) compilation, called HHVM They introduced Hack, a variant of PHP with a typing system 12 / 52

4 And other examples... Google with Java, Dalvik, ART... Python with CPython vs pypy... Qt's JavaScript, switching from AST Interpretation to JIT and to a mix of JIT and AST Interpretation... Lectures 1Introduction 2Declarative Computation Model 3Declarative Concurrency and Message Passing 4Imperative programming Model 5Virtual Machines and Bytecode 6Object-Oriented Programming Model 7Macro 8Running natively JIT and Garbage Collection 9Concurrency 10Relational Programming 11GUI Programming 12Summary 13 / / 52 Book(s) Concepts, Techniques, and Models of Computer Programming by Peter Van Roy and Seif Haridi Structure and Interpretation of Computer Programs in Python by Hal Abelson, Jerry Sussman, Julie Sussman and John Denero Structure and Interpretation of Computer Programs by Hal Abelson, Jerry Sussman and Julie Sussman List of labs 1Functional Programming 2Substitution model of evaluation 3Bytecode executor 4Macros 5Garbage collector 6SQpy 15 / / 52

5 Division of time 24h lectures (in 12 sessions) 40h labs (in 20 sessions) 8h tutorials (in 4 sessions) 88h homework Last year evaluation and improvments Too much overlap with other courses Course book is not interesting New lectures focused on programming models and evaluation models Switch to a different course book Transition to a new lab serie 17 / / 52 Defining a programming language Concepts and models of programming languages Syntax Defines what is valid. Defined by grammar rules Define how to make statements out of tokens Semantics Define what the program does during execution It should be simple and allows to reason about the program Text characters Lexer tokens Parser statements Interpreter 20 / 52

6 Concepts-based approach How to differentiate programming languages? Factorize programming language according to concept used Java: procedure, closure, state, SQL (SELECT): procedure, closure, search,... Adding concepts solve limitations in expressiveness (creative extension principle) but added to the learning curve and complexity of the The different programming paradigms 21 / 52 What is a programming paradigm? Programming paradigm is a method of classification of programming language according to their style and features. How to define a paradigm? How to match a language to a paradigm? 23 / / 52

7 Programming Paradigm (2/2) declarative functional Imperative Symbolic Constraint Logic Object-Oriented Declarative Expresses logic of computation without control flow: What should be computed and not how it should be computed. Examples: XML/HTML, antlr4/yacc/ regular expressions, make/ants, SQL, / / 52 Declarative - Examples <b>hello world!</b> SELECT name FROM student WHERE course eq 'TDDA69' grammar Hello; r : 'hello' ID; ID : [a-z]+ ; WS : [' '\t\r\n]+ -> skip ; 27 / 52 Functional Computation are treated as mathematical function without changing any internal state Examples: Lisp, Scheme, Haskell / 52

8 Functional - Examples (print "Hello World") (take 25 (squares-of (integers))) -> ( ) Imperative Express how computation are executed Describes computation in term of statements that change the internal state Examples: C/C++, Pascal, Java, Python, JavaScript / / 52 Imperative - Examples Object-Oriented for(var i = 1; i < 26; ++i) { var sq = i*i; console.log(sq) #include <stdio.h> int main() { char ch; printf("enter a character\n"); scanf("%c", &ch); if (ch == 'a' ch == 'A' ch == 'e' ch == 'E' ch == 'i' ch == 'I' ch =='o' ch=='o' ch == 'u' ch == 'U') printf("%c is a vowel.\n", ch); else printf("%c is not a vowel.\n", ch); return 0; Based on the concept of objects, which are data structures containing fields and methods Programs are designed by making objects interact with each others Examples: C++, Java, C#, Python, Ruby, JavaScript / / 52

9 Object-Oriented - Programming #include <iostream> class Character : public Symbol { public: Character(char _c) : m_c(_c) { bool isvowel() const { return ch == 'a' ch == 'A' ch == 'e' ch == 'E' ch == 'i' ch == 'I' ch =='o' ch=='o' ch == 'u' ch == 'U'; private: char m_c; ; int main() { char c; std::cout << "Enter a character:\n"; std::cin >> c; Character ch(c); if(ch.isvowel()) { std::cout << c << " is a vowel.\n"; else { std::cout << c << " is not a vowel.\n"; Logic and symbolic Logic Based on Formal logic: expressing facts and rules Symbolic A program can manipulate its own formulas and components as if they are data Example: prolog 33 / / 52 Logic programming likes(mary,food). likes(mary,wine). likes(john,wine). likes(john,mary).?- likes(mary,food). yes.?- likes(john,wine). yes.?- likes(john,food). 35 / 52 Symbolic programming d( X, X, 1 ):-!. /* d(x) w.r.t. X is 1 */ d( C, X, 0 ):- atomic(c). /* If C is a constant */ /* then d(c)/dx is 0 */ d( U+V, X, R ):- /* d(u+v)/dx = A+B where */ d( U, X, A ), /* A = d(u)/dx and */ d( V, X, B ), R = A + B.... d( sin(w), X, Z*cos(W) ):- /* d(sin(w))/dx = Z*cos(W) */ d( W, X, Z). /* where Z = d(w)/dx */ d( exp(w), X, Z*exp(W) ):- /* d(exp(w))/dx = Z*exp(W) */ d( W, X, Z). /* where Z = d(w)/dx */...?- d(cos(2*x+1), X, what) what = 2*sin(2*X+1) 36 / 52

10 Constraint Programming Constraint A relation between two variables are stated in the form of a constraint (can be logic or numerical) Example: Oz (functional), Kaleidoscope (imperative), Prolog (logic) 37 / 52 Constraint Programming - Examples local proc {MyScript Solution X = {FD.int 1#10 Y = {FD.int 1#10 Z = {FD.int 1#10 in Solution = unit(x:x y:y z:z) X + Y =: Z X <: Y %% search strategy {FD.distribute naive Solution end in {Browse {SearchAll MyScript end 38 / 52 Is there a paradigm to rule them all? Why different paradigms? In theory you can program everything in C/C++ and imperative programming, or functional programming... But is that convenient? And is that safe? 40 / 52

11 Functional vs Imperative Declarative vs Imperative Double all the numbers in an array var numbers = [1,2,3,4,5] Imperative: var doubled = [] for(var i = 0; i < numbers.length; i++) { var newnumber = numbers[i] * 2 doubled.push(newnumber) Functional: var doubled = numbers.map(function(n) { return n * 2 ) 41 / 52 Select all the dogs that belongs to a specific owner Declarative: SELECT * from dogs INNER JOIN owners WHERE dogs.owner_id = owners.id Imperative: var dogswithowners = [] var dog, owner for(var dog in dogs) { for(var owner in owners) { if (owner && dog.owner_id == owner.id) { dogswithowners.push({ dog: dog, owner: owner ) 42 / 52 Functional vs Imperative Imperative language (C/C++, Java...) Basic constructs are imperative statements Change existing values, states x = x + 1 y = f(x) while(x>0)... Functional language Basic constructs are declarative Declare new values function f(x) { return x + 1; Computations are primarily done by evaluating expressions Pure if all constructs are declarative Introduction to KL 43 / 52

12 Kernel Language How can we seperate and identify the fundamental concepts of a language? Approach to give a scientific basis to programming: Lambda calculus: reduce programming to a minimal number of elements Virtual machine: defines a language as an implementation Multiparadigm language Kernel language: is the minimal language that you need for a given paradigm Kernel Language The most simple language Select a computation model Define a mapping scheme of full programming language into the kernel language 45 / / 52 KL Linguistic abstractions vs syntaxic suga Practical language Kernel language Practical language Provides usefull abstractions for the programmer Can be extended with linguistic abstractions Kernel language Easy to understand and reason Has a precise (formal) semantic Linguistic abstractions, provide higher level concepts that the programmer can use to model, and reasons about programs functions, iterations, classes, streams... Syntactic sugar are short cuts to improve readability 47 / / 52

13 KL Syntax KL is (almost) a Kernel Language You will be developing its interpreter during the labs Written in RPython It is defined as: syntax: close to C/JavaScript semantic: +procedure+closure+cell In the future, based on the idea of adding concepts Mapping through a macro system (lecture 7) 49 / / 52 Modules Conclusion Course organisation Different programming paradigms KL 51 / / 52

Lecture content. Course goals. Course Introduction. TDDA69 Data and Program Structure Introduction

Lecture content. Course goals. Course Introduction. TDDA69 Data and Program Structure Introduction Lecture content TDDA69 Data and Program Structure Introduction Cyrille Berger Course Introduction Introduction to the different Programming Paradigm The different programming paradigms Why different paradigms?

More information

Lecture content. Course goals. Course Introduction. TDDA69 Data and Program Structure Introduction

Lecture content. Course goals. Course Introduction. TDDA69 Data and Program Structure Introduction Lecture content TDDA69 Data and Program Structure Introduction Cyrille Berger Course Introduction to the different Programming Paradigm The different programming paradigm Why different paradigms? Introduction

More information

CS 242. Fundamentals. Reading: See last slide

CS 242. Fundamentals. Reading: See last slide CS 242 Fundamentals Reading: See last slide Syntax and Semantics of Programs Syntax The symbols used to write a program Semantics The actions that occur when a program is executed Programming language

More information

CS152 Programming Language Paradigms Prof. Tom Austin, Fall Syntax & Semantics, and Language Design Criteria

CS152 Programming Language Paradigms Prof. Tom Austin, Fall Syntax & Semantics, and Language Design Criteria CS152 Programming Language Paradigms Prof. Tom Austin, Fall 2014 Syntax & Semantics, and Language Design Criteria Lab 1 solution (in class) Formally defining a language When we define a language, we need

More information

Functional Programming and Haskell

Functional Programming and Haskell Functional Programming and Haskell Tim Dawborn University of Sydney, Australia School of Information Technologies Tim Dawborn Functional Programming and Haskell 1/22 What are Programming Paradigms? A programming

More information

COP4020 Programming Languages. Compilers and Interpreters Robert van Engelen & Chris Lacher

COP4020 Programming Languages. Compilers and Interpreters Robert van Engelen & Chris Lacher COP4020 ming Languages Compilers and Interpreters Robert van Engelen & Chris Lacher Overview Common compiler and interpreter configurations Virtual machines Integrated development environments Compiler

More information

Lecture 1: Introduction. 23. August, 2010

Lecture 1: Introduction. 23. August, 2010 Lecture 1: Introduction 23. August, 2010 Lecture Outline TDT4165 Administratrivia Programming Languages Introduction Illustration Hello World Programs Further Comments Summary TDT4165 Administratrivia

More information

Programming Language Concepts, cs2104 Lecture 04 ( )

Programming Language Concepts, cs2104 Lecture 04 ( ) Programming Language Concepts, cs2104 Lecture 04 (2003-08-29) Seif Haridi Department of Computer Science, NUS haridi@comp.nus.edu.sg 2003-09-05 S. Haridi, CS2104, L04 (slides: C. Schulte, S. Haridi) 1

More information

Compiling and Interpreting Programming. Overview of Compilers and Interpreters

Compiling and Interpreting Programming. Overview of Compilers and Interpreters Copyright R.A. van Engelen, FSU Department of Computer Science, 2000 Overview of Compilers and Interpreters Common compiler and interpreter configurations Virtual machines Integrated programming environments

More information

Seminar in Programming Languages

Seminar in Programming Languages Seminar in Programming Languages Shuly Wintner Fall 2010-11 Course web site: http://cs.haifa.ac.il/~shuly/teaching/10/plseminar/ Course Goals Programming Language Concepts A language is a conceptual universe

More information

Programming Paradigms and Languages Introduction. dr Robert Kowalczyk WMiI UŁ

Programming Paradigms and Languages Introduction. dr Robert Kowalczyk WMiI UŁ Programming Paradigms and Languages Introduction dr Robert Kowalczyk WMiI UŁ What is a programming paradigm? A programming paradigm is a fundamental style of computer programming, a way of building the

More information

Com S 541. Programming Languages I

Com S 541. Programming Languages I Programming Languages I Lecturer: TA: Markus Lumpe Department of Computer Science 113 Atanasoff Hall http://www.cs.iastate.edu/~lumpe/coms541.html TR 12:40-2, W 5 Pramod Bhanu Rama Rao Office hours: TR

More information

CSCI 3136 Principles of Programming Languages

CSCI 3136 Principles of Programming Languages CSCI 3136 Principles of Programming Languages Summer 2013 Faculty of Computer Science Dalhousie University 1 / 100 CSCI 3136 Principles of Programming Languages Summer 2013 Aminul Islam Faculty of Computer

More information

CS 314 Principles of Programming Languages

CS 314 Principles of Programming Languages CS 314 Principles of Programming Languages Lecture 15: Review and Functional Programming Zheng (Eddy) Zhang Rutgers University March 19, 2018 Class Information Midterm exam forum open in Sakai. HW4 and

More information

A Tour of Language Implementation

A Tour of Language Implementation 1 CSCE 314: Programming Languages Dr. Flemming Andersen A Tour of Language Implementation Programming is no minor feat. Prometheus Brings Fire by Heinrich Friedrich Füger. Image source: https://en.wikipedia.org/wiki/prometheus

More information

On Academic Dishonesty. Declarative Computation Model. Single assignment store. Single assignment store (2) Single assignment store (3)

On Academic Dishonesty. Declarative Computation Model. Single assignment store. Single assignment store (2) Single assignment store (3) Declarative Computation Model Single assignment store (VRH 2.2) Kernel language syntax (VRH 2.3) Carlos Varela RPI October 6, 2009 Adapted with permission from: Seif Haridi KTH Peter Van Roy UCL On Academic

More information

Programmiersprachen (Programming Languages)

Programmiersprachen (Programming Languages) 2016-05-13 Preface Programmiersprachen (Programming Languages) coordinates: lecturer: web: usable for: requirements: No. 185.208, VU, 3 ECTS Franz Puntigam http://www.complang.tuwien.ac.at/franz/ps.html

More information

SKILL AREA 304: Review Programming Language Concept. Computer Programming (YPG)

SKILL AREA 304: Review Programming Language Concept. Computer Programming (YPG) SKILL AREA 304: Review Programming Language Concept Computer Programming (YPG) 304.1 Demonstrate an Understanding of Basic of Programming Language 304.1.1 Explain the purpose of computer program 304.1.2

More information

Concepts of Programming Languages

Concepts of Programming Languages Concepts of Programming Languages Lecture 1 - Introduction Patrick Donnelly Montana State University Spring 2014 Patrick Donnelly (Montana State University) Concepts of Programming Languages Spring 2014

More information

CSCE 314 Programming Languages. Type System

CSCE 314 Programming Languages. Type System CSCE 314 Programming Languages Type System Dr. Hyunyoung Lee 1 Names Names refer to different kinds of entities in programs, such as variables, functions, classes, templates, modules,.... Names can be

More information

Programming language design and analysis

Programming language design and analysis Programming language design and analysis Introduction Marius Minea 25 September 2017 Why this course? Programming languages are fundamental and one of the oldest CS fields Language design is an important

More information

CIS 194: Homework 3. Due Wednesday, February 11, Interpreters. Meet SImPL

CIS 194: Homework 3. Due Wednesday, February 11, Interpreters. Meet SImPL CIS 194: Homework 3 Due Wednesday, February 11, 2015 Interpreters An interpreter is a program that takes another program as an input and evaluates it. Many modern languages such as Java 1, Javascript,

More information

CSc 372. Comparative Programming Languages. 2 : Functional Programming. Department of Computer Science University of Arizona

CSc 372. Comparative Programming Languages. 2 : Functional Programming. Department of Computer Science University of Arizona 1/37 CSc 372 Comparative Programming Languages 2 : Functional Programming Department of Computer Science University of Arizona collberg@gmail.com Copyright c 2013 Christian Collberg 2/37 Programming Paradigms

More information

Introduction. A. Bellaachia Page: 1

Introduction. A. Bellaachia Page: 1 Introduction 1. Objectives... 2 2. Why are there so many programming languages?... 2 3. What makes a language successful?... 2 4. Programming Domains... 3 5. Language and Computer Architecture... 4 6.

More information

COMP-421 Compiler Design. Presented by Dr Ioanna Dionysiou

COMP-421 Compiler Design. Presented by Dr Ioanna Dionysiou COMP-421 Compiler Design Presented by Dr Ioanna Dionysiou Administrative! Next time reading assignment [ALSU07] Chapters 1,2 [ALSU07] Sections 1.1-1.5 (cover in class) [ALSU07] Section 1.6 (read on your

More information

Chapter 1. Preliminaries

Chapter 1. Preliminaries Chapter 1 Preliminaries Chapter 1 Topics Reasons for Studying Concepts of Programming Languages Programming Domains Language Evaluation Criteria Influences on Language Design Language Categories Language

More information

Functional Programming Lecture 1: Introduction

Functional Programming Lecture 1: Introduction Functional Programming Lecture 1: Introduction Viliam Lisý Artificial Intelligence Center Department of Computer Science FEE, Czech Technical University in Prague viliam.lisy@fel.cvut.cz Acknowledgements

More information

Programming Languages, Summary CSC419; Odelia Schwartz

Programming Languages, Summary CSC419; Odelia Schwartz Programming Languages, Summary CSC419; Odelia Schwartz Chapter 1 Topics Reasons for Studying Concepts of Programming Languages Programming Domains Language Evaluation Criteria Influences on Language Design

More information

CS 360 Programming Languages Interpreters

CS 360 Programming Languages Interpreters CS 360 Programming Languages Interpreters Implementing PLs Most of the course is learning fundamental concepts for using and understanding PLs. Syntax vs. semantics vs. idioms. Powerful constructs like

More information

Foundations. Yu Zhang. Acknowledgement: modified from Stanford CS242

Foundations. Yu Zhang. Acknowledgement: modified from Stanford CS242 Spring 2013 Foundations Yu Zhang Acknowledgement: modified from Stanford CS242 https://courseware.stanford.edu/pg/courses/317431/ Course web site: http://staff.ustc.edu.cn/~yuzhang/fpl Reading Concepts

More information

CSE 413 Languages & Implementation. Hal Perkins Winter 2019 Structs, Implementing Languages (credits: Dan Grossman, CSE 341)

CSE 413 Languages & Implementation. Hal Perkins Winter 2019 Structs, Implementing Languages (credits: Dan Grossman, CSE 341) CSE 413 Languages & Implementation Hal Perkins Winter 2019 Structs, Implementing Languages (credits: Dan Grossman, CSE 341) 1 Goals Representing programs as data Racket structs as a better way to represent

More information

Compilers. Prerequisites

Compilers. Prerequisites Compilers Prerequisites Data structures & algorithms Linked lists, dictionaries, trees, hash tables Formal languages & automata Regular expressions, finite automata, context-free grammars Machine organization

More information

Programming Languages (CSCI 4430/6430) History, Syntax, Semantics, Essentials, Paradigms

Programming Languages (CSCI 4430/6430) History, Syntax, Semantics, Essentials, Paradigms Programming Languages (CSCI 4430/6430) History, Syntax, Semantics, Essentials, Paradigms Carlos Varela Rennselaer Polytechnic Institute August 30, 2016 C. Varela 1 The first programmer ever Ada Augusta,

More information

CSCI 2041: Advanced Language Processing

CSCI 2041: Advanced Language Processing CSCI 2041: Advanced Language Processing Chris Kauffman Last Updated: Wed Nov 28 13:25:47 CST 2018 1 Logistics Reading OSM: Ch 17 The Debugger OSM: Ch 13 Lexer and Parser Generators (optional) Practical

More information

CS 3304 Comparative Languages. Lecture 1: Introduction

CS 3304 Comparative Languages. Lecture 1: Introduction CS 3304 Comparative Languages Lecture 1: Introduction 17 January 2012 2012 Denis Gracanin Course Overview 2 Welcome What this course is about? What this course is not about? What will you learn? How will

More information

INTRODUCTION PRINCIPLES OF PROGRAMMING LANGUAGES. Norbert Zeh Winter Dalhousie University 1/10

INTRODUCTION PRINCIPLES OF PROGRAMMING LANGUAGES. Norbert Zeh Winter Dalhousie University 1/10 INTRODUCTION PRINCIPLES OF PROGRAMMING LANGUAGES Norbert Zeh Winter 2018 Dalhousie University 1/10 GOAL OF THIS COURSE 2/10 GOAL OF THIS COURSE Encourage you to become better programmers 2/10 GOAL OF THIS

More information

Computer Components. Software{ User Programs. Operating System. Hardware

Computer Components. Software{ User Programs. Operating System. Hardware Computer Components Software{ User Programs Operating System Hardware What are Programs? Programs provide instructions for computers Similar to giving directions to a person who is trying to get from point

More information

Scientific Computing

Scientific Computing Scientific Computing Martin Lotz School of Mathematics The University of Manchester Lecture 1, September 22, 2014 Outline Course Overview Programming Basics The C++ Programming Language Outline Course

More information

General Concepts. Abstraction Computational Paradigms Implementation Application Domains Influence on Success Influences on Design

General Concepts. Abstraction Computational Paradigms Implementation Application Domains Influence on Success Influences on Design General Concepts Abstraction Computational Paradigms Implementation Application Domains Influence on Success Influences on Design 1 Abstractions in Programming Languages Abstractions hide details that

More information

Compilation I. Hwansoo Han

Compilation I. Hwansoo Han Compilation I Hwansoo Han Language Groups Imperative von Neumann (Fortran, Pascal, Basic, C) Object-oriented (Smalltalk, Eiffel, C++) Scripting languages (Perl, Python, JavaScript, PHP) Declarative Functional

More information

Language Translation, History. CS152. Chris Pollett. Sep. 3, 2008.

Language Translation, History. CS152. Chris Pollett. Sep. 3, 2008. Language Translation, History. CS152. Chris Pollett. Sep. 3, 2008. Outline. Language Definition, Translation. History of Programming Languages. Language Definition. There are several different ways one

More information

CSC312 Principles of Programming Languages : Functional Programming Language. Copyright 2006 The McGraw-Hill Companies, Inc.

CSC312 Principles of Programming Languages : Functional Programming Language. Copyright 2006 The McGraw-Hill Companies, Inc. CSC312 Principles of Programming Languages : Functional Programming Language Overview of Functional Languages They emerged in the 1960 s with Lisp Functional programming mirrors mathematical functions:

More information

Comp 333: Concepts of Programming Languages Fall 2016

Comp 333: Concepts of Programming Languages Fall 2016 Comp 333: Concepts of Programming Languages Fall 2016 Instructor: Professor Schwartz History Syntax and Semantics Compilers Language Constructs Names, Binding, Scoping, Data Types Expressions, Control

More information

Final-Term Papers Solved MCQS with Reference

Final-Term Papers Solved MCQS with Reference Solved MCQ(S) From FinalTerm Papers BY Arslan Jan 14, 2018 V-U For Updated Files Visit Our Site : Www.VirtualUstaad.blogspot.com Updated. Final-Term Papers Solved MCQS with Reference 1. The syntax of PHP

More information

8/27/17. CS-3304 Introduction. What will you learn? Semester Outline. Websites INTRODUCTION TO PROGRAMMING LANGUAGES

8/27/17. CS-3304 Introduction. What will you learn? Semester Outline. Websites INTRODUCTION TO PROGRAMMING LANGUAGES CS-3304 Introduction In Text: Chapter 1 & 2 COURSE DESCRIPTION 2 What will you learn? Survey of programming paradigms, including representative languages Language definition and description methods Overview

More information

CSCI.4430/6969 Programming Languages Lecture Notes

CSCI.4430/6969 Programming Languages Lecture Notes CSCI.4430/6969 Programming Languages Lecture Notes August 28, 2006 1 Brief History of Programming Languages Ada Augusta, the Countess of Lovelace, the daughter of the poet Lord Byron, is attributed as

More information

Lecture 4: The Declarative Sequential Kernel Language. September 5th 2011

Lecture 4: The Declarative Sequential Kernel Language. September 5th 2011 Lecture 4: The Declarative Sequential Kernel Language September 5th 2011 1 Lecture Outline Syntactic Analysis of Programs contd Scanning contd The Declarative Kernel Language Introduction Syntax of the

More information

CS 415 Midterm Exam Spring 2002

CS 415 Midterm Exam Spring 2002 CS 415 Midterm Exam Spring 2002 Name KEY Email Address Student ID # Pledge: This exam is closed note, closed book. Good Luck! Score Fortran Algol 60 Compilation Names, Bindings, Scope Functional Programming

More information

Why are there so many programming languages?

Why are there so many programming languages? Chapter 1 :: Introduction Programming Language Pragmatics, Fourth Edition Michael L. Scott Copyright 2016 Elsevier 1 Chapter01_ Introduction_4e - Tue November 21, 2017 Introduction Why are there so many

More information

Modern Stored Procedures Using GraalVM

Modern Stored Procedures Using GraalVM Modern Stored Procedures Using raalvm Oracle Labs Matthias Brantner Safe Harbor Statement The following is intended to outline our general product direction. t is intended

More information

Seminar on Languages for Scientific Computing Aachen, 6 Feb Navid Abbaszadeh.

Seminar on Languages for Scientific Computing Aachen, 6 Feb Navid Abbaszadeh. Scientific Computing Aachen, 6 Feb 2014 navid.abbaszadeh@rwth-aachen.de Overview Trends Introduction Paradigms, Data Structures, Syntax Compilation & Execution Concurrency Model Reference Types Performance

More information

CST-402(T): Language Processors

CST-402(T): Language Processors CST-402(T): Language Processors Course Outcomes: On successful completion of the course, students will be able to: 1. Exhibit role of various phases of compilation, with understanding of types of grammars

More information

New Programming Paradigms

New Programming Paradigms New Programming Paradigms Lecturer: Pánovics János (google the name for further details) Requirements: For signature: classroom work and a 15-minute presentation Exam: written exam (mainly concepts and

More information

Semantic Analysis. Outline. The role of semantic analysis in a compiler. Scope. Types. Where we are. The Compiler Front-End

Semantic Analysis. Outline. The role of semantic analysis in a compiler. Scope. Types. Where we are. The Compiler Front-End Outline Semantic Analysis The role of semantic analysis in a compiler A laundry list of tasks Scope Static vs. Dynamic scoping Implementation: symbol tables Types Static analyses that detect type errors

More information

Syntax and Grammars 1 / 21

Syntax and Grammars 1 / 21 Syntax and Grammars 1 / 21 Outline What is a language? Abstract syntax and grammars Abstract syntax vs. concrete syntax Encoding grammars as Haskell data types What is a language? 2 / 21 What is a language?

More information

Programming Language Concepts, cs2104 Lecture 01 ( )

Programming Language Concepts, cs2104 Lecture 01 ( ) Programming Language Concepts, cs2104 Lecture 01 (2003-08-15) Seif Haridi Department of Computer Science, NUS haridi@comp.nus.edu.sg 2002-08-15 S. Haridi, CS2104, L01 (slides: C. Schulte, S. Haridi) 1

More information

CSCI-GA Scripting Languages

CSCI-GA Scripting Languages CSCI-GA.3033.003 Scripting Languages 12/02/2013 OCaml 1 Acknowledgement The material on these slides is based on notes provided by Dexter Kozen. 2 About OCaml A functional programming language All computation

More information

Equivalent Notations. Higher-Order Functions. (define (f x y) ( body )) = (define f (lambda (x y) ) ) Anonymous Functions.

Equivalent Notations. Higher-Order Functions. (define (f x y) ( body )) = (define f (lambda (x y) ) ) Anonymous Functions. Equivalent Notations Higher-Order Functions cs480 (Prasad L156HOF 1 (define (f x y ( body = (define f (lambda (x y ( body cs480 (Prasad L156HOF 2 Function Values (define tag (lambda (t l (cons t l (tag

More information

CSE450. Translation of Programming Languages. Lecture 11: Semantic Analysis: Types & Type Checking

CSE450. Translation of Programming Languages. Lecture 11: Semantic Analysis: Types & Type Checking CSE450 Translation of Programming Languages Lecture 11: Semantic Analysis: Types & Type Checking Structure Project 1 - of a Project 2 - Compiler Today! Project 3 - Source Language Lexical Analyzer Syntax

More information

CSE413: Programming Languages and Implementation Racket structs Implementing languages with interpreters Implementing closures

CSE413: Programming Languages and Implementation Racket structs Implementing languages with interpreters Implementing closures CSE413: Programming Languages and Implementation Racket structs Implementing languages with interpreters Implementing closures Dan Grossman Fall 2014 Hi! I m not Hal J I love this stuff and have taught

More information

Overview. Rationale Division of labour between script and C++ Choice of language(s) Interfacing to C++

Overview. Rationale Division of labour between script and C++ Choice of language(s) Interfacing to C++ Scripting 1 Overview Rationale Division of labour between script and C++ Choice of language(s) Interfacing to C++ Rationale C++ isn't the best choice for all problems Complicated feature set, syntax Low-level,

More information

COMPILER DESIGN LECTURE NOTES

COMPILER DESIGN LECTURE NOTES COMPILER DESIGN LECTURE NOTES UNIT -1 1.1 OVERVIEW OF LANGUAGE PROCESSING SYSTEM 1.2 Preprocessor A preprocessor produce input to compilers. They may perform the following functions. 1. Macro processing:

More information

Organization of Programming Languages CS3200/5200N. Lecture 11

Organization of Programming Languages CS3200/5200N. Lecture 11 Organization of Programming Languages CS3200/5200N Razvan C. Bunescu School of Electrical Engineering and Computer Science bunescu@ohio.edu Functional vs. Imperative The design of the imperative languages

More information

Chapter 11 Introduction to Programming in C

Chapter 11 Introduction to Programming in C Chapter 11 Introduction to Programming in C C: A High-Level Language Gives symbolic names for containers of values don t need to know which register or memory location Provides abstraction of underlying

More information

The role of semantic analysis in a compiler

The role of semantic analysis in a compiler Semantic Analysis Outline The role of semantic analysis in a compiler A laundry list of tasks Scope Static vs. Dynamic scoping Implementation: symbol tables Types Static analyses that detect type errors

More information

CSC 326H1F, Fall Programming Languages. What languages do you know? Instructor: Ali Juma. A survey of counted loops: FORTRAN

CSC 326H1F, Fall Programming Languages. What languages do you know? Instructor: Ali Juma. A survey of counted loops: FORTRAN What languages do you know? CSC 326H1F, Programming Languages The usual suspects: C, C++, Java fine languages nearly the same Perhaps you've also learned some others? assembler Basic, Visual Basic, Turing,

More information

MIDTERM EXAMINATION. CSE 130: Principles of Programming Languages. Professor Goguen. February 16, points total

MIDTERM EXAMINATION. CSE 130: Principles of Programming Languages. Professor Goguen. February 16, points total CSE 130, Winter 2006 MIDTERM EXAMINATION CSE 130: Principles of Programming Languages Professor Goguen February 16, 2006 100 points total Don t start the exam until you are told to. Turn off any cell phone

More information

CS101 Introduction to Programming Languages and Compilers

CS101 Introduction to Programming Languages and Compilers CS101 Introduction to Programming Languages and Compilers In this handout we ll examine different types of programming languages and take a brief look at compilers. We ll only hit the major highlights

More information

Outline. Introduction to Programming (in C++) Introduction. First program in C++ Programming examples

Outline. Introduction to Programming (in C++) Introduction. First program in C++ Programming examples Outline Introduction to Programming (in C++) Introduction Programming examples Algorithms, programming languages and computer programs Jordi Cortadella, Ricard Gavaldà, Fernando Orejas Dept. of Computer

More information

Functional Programming. Big Picture. Design of Programming Languages

Functional Programming. Big Picture. Design of Programming Languages Functional Programming Big Picture What we ve learned so far: Imperative Programming Languages Variables, binding, scoping, reference environment, etc What s next: Functional Programming Languages Semantics

More information

Programming (ERIM) Lecture 1: Introduction to programming paradigms and typing systems. Tommi Tervonen

Programming (ERIM) Lecture 1: Introduction to programming paradigms and typing systems. Tommi Tervonen Programming (ERIM) Lecture 1: Introduction to programming paradigms and typing systems Tommi Tervonen Econometric Institute, Erasmus School of Economics Course learning objectives After this course, you

More information

CS558 Programming Languages

CS558 Programming Languages CS558 Programming Languages Fall 2016 Lecture 7a Andrew Tolmach Portland State University 1994-2016 Values and Types We divide the universe of values according to types A type is a set of values and a

More information

Introduction to Engineering Using Robotics Experiments. Dr. Yinong Chen

Introduction to Engineering Using Robotics Experiments. Dr. Yinong Chen Introduction to Engineering Using Robotics Experiments Dr. Yinong Chen Outline Historical Perspective Programming Language Generations Programming Language Paradigms Imperative Programming Paradigm Writing

More information

CS A331 Programming Language Concepts

CS A331 Programming Language Concepts CS A331 Programming Language Concepts Lecture 4 Programming Language Semantics and Code Generation February 3, 2014 Sam Siewert PLP Companion Materials CD-ROM is On-Line: http://booksite.elsevier.com/9780123745149/?isbn=978

More information

Outline. Introduction Concepts and terminology The case for static typing. Implementing a static type system Basic typing relations Adding context

Outline. Introduction Concepts and terminology The case for static typing. Implementing a static type system Basic typing relations Adding context Types 1 / 15 Outline Introduction Concepts and terminology The case for static typing Implementing a static type system Basic typing relations Adding context 2 / 15 Types and type errors Type: a set of

More information

CS133 C Programming. Instructor: Jialiang Lu Office: Information Center 703

CS133 C Programming. Instructor: Jialiang Lu   Office: Information Center 703 CS133 C Programming Instructor: Jialiang Lu Email: jialiang.lu@sjtu.edu.cn Office: Information Center 703 1 Course Information: Course Page: http://wirelesslab.sjtu.edu.cn/~jlu/teaching/cp2014/ Assignments

More information

Overview. Rationale Division of labour between script and C++ Choice of language(s) Interfacing to C++ Performance, memory

Overview. Rationale Division of labour between script and C++ Choice of language(s) Interfacing to C++ Performance, memory SCRIPTING Overview Rationale Division of labour between script and C++ Choice of language(s) Interfacing to C++ Reflection Bindings Serialization Performance, memory Rationale C++ isn't the best choice

More information

C and C++ I. Spring 2014 Carola Wenk

C and C++ I. Spring 2014 Carola Wenk C and C++ I Spring 2014 Carola Wenk Different Languages Python sum = 0 i = 1 while (i

More information

Chapter 1 Preliminaries

Chapter 1 Preliminaries Chapter 1 Preliminaries Chapter 1 Topics Reasons for Studying Concepts of Programming Languages Programming Domains Language Evaluation Criteria Influences on Language Design Language Categories Language

More information

SOFTWARE ARCHITECTURE 6. LISP

SOFTWARE ARCHITECTURE 6. LISP 1 SOFTWARE ARCHITECTURE 6. LISP Tatsuya Hagino hagino@sfc.keio.ac.jp slides URL https://vu5.sfc.keio.ac.jp/sa/ 2 Compiler vs Interpreter Compiler Translate programs into machine languages Compilers are

More information

Outline. Programming Languages 1/16/18 PROGRAMMING LANGUAGE FOUNDATIONS AND HISTORY. Current

Outline. Programming Languages 1/16/18 PROGRAMMING LANGUAGE FOUNDATIONS AND HISTORY. Current PROGRAMMING LANGUAGE FOUNDATIONS AND HISTORY Dr. John Georgas, Northern Arizona University Copyright John Georgas All Rights Reserved Outline Current Programming languages Compiled and interpreted implementations

More information

Lecture 13: Expression Evaluation

Lecture 13: Expression Evaluation The University of North Carolina at Chapel Hill Spring 2002 Lecture 13: Expression Evaluation Feb 8 1 Control Flow Control flow refers to the order in which a program executes This is fundamental in the

More information

Lecture 1. Introduction to course, Welcome to Engineering, What is Programming and Why is this the first thing being covered in Engineering?

Lecture 1. Introduction to course, Welcome to Engineering, What is Programming and Why is this the first thing being covered in Engineering? Lecture 1 Introduction to course, Welcome to Engineering, What is Programming and Why is this the first thing being covered in Engineering? Welcome to ENGR 102 Syllabus review Your Time Expectations (in

More information

Lecture 6: The Declarative Kernel Language Machine. September 13th, 2011

Lecture 6: The Declarative Kernel Language Machine. September 13th, 2011 Lecture 6: The Declarative Kernel Language Machine September 13th, 2011 Lecture Outline Computations contd Execution of Non-Freezable Statements on the Abstract Machine The skip Statement The Sequential

More information

Data Abstraction. An Abstraction for Inductive Data Types. Philip W. L. Fong.

Data Abstraction. An Abstraction for Inductive Data Types. Philip W. L. Fong. Data Abstraction An Abstraction for Inductive Data Types Philip W. L. Fong pwlfong@cs.uregina.ca Department of Computer Science University of Regina Regina, Saskatchewan, Canada Introduction This lecture

More information

Functional Languages. CSE 307 Principles of Programming Languages Stony Brook University

Functional Languages. CSE 307 Principles of Programming Languages Stony Brook University Functional Languages CSE 307 Principles of Programming Languages Stony Brook University http://www.cs.stonybrook.edu/~cse307 1 Historical Origins 2 The imperative and functional models grew out of work

More information

What is a programming language?

What is a programming language? Overview Introduction Motivation Why study programming languages? Some key concepts What is a programming language? What is a programming language?...there is no agreement on what a programming language

More information

Lecture 1: Course Introduction

Lecture 1: Course Introduction Lecture 1: Course Introduction CS164: Programming Languages and Compilers P. N. Hilfinger, 787 Soda Spring 2015 Acknowledgement. Portions taken from CS164 notes by G. Necula. Last modified: Wed Jan 21

More information

Chapter 1. Preview. Reason for Studying OPL. Language Evaluation Criteria. Programming Domains

Chapter 1. Preview. Reason for Studying OPL. Language Evaluation Criteria. Programming Domains Chapter 1. Preview Reason for Studying OPL Reason for Studying OPL? Programming Domains Language Evaluation Criteria Language Categories Language Design Trade-Offs Implementation Methods Programming Environments

More information

Topic 9: Type Checking

Topic 9: Type Checking Recommended Exercises and Readings Topic 9: Type Checking From Haskell: The craft of functional programming (3 rd Ed.) Exercises: 13.17, 13.18, 13.19, 13.20, 13.21, 13.22 Readings: Chapter 13.5, 13.6 and

More information

Topic 9: Type Checking

Topic 9: Type Checking Topic 9: Type Checking 1 Recommended Exercises and Readings From Haskell: The craft of functional programming (3 rd Ed.) Exercises: 13.17, 13.18, 13.19, 13.20, 13.21, 13.22 Readings: Chapter 13.5, 13.6

More information

Introduction to the course and basic programming concepts

Introduction to the course and basic programming concepts Introduction to the course and basic programming concepts Lecture 1 of TDA 540 Object-Oriented Programming Jesper Cockx Fall 2018 Chalmers University of Technology Gothenburg University About the course

More information

What is a compiler? Xiaokang Qiu Purdue University. August 21, 2017 ECE 573

What is a compiler? Xiaokang Qiu Purdue University. August 21, 2017 ECE 573 What is a compiler? Xiaokang Qiu Purdue University ECE 573 August 21, 2017 What is a compiler? What is a compiler? Traditionally: Program that analyzes and translates from a high level language (e.g.,

More information

Principles of Compiler Construction ( )

Principles of Compiler Construction ( ) Principles of Compiler Construction ( ) Dr Mayer Goldberg October 25, 2017 Contents 1 Course Objectives 1 2 Course Requirements 2 3 Detailed Syllabus 3 4 Computation of grade 6 5 References 6 Course number:

More information

CS383 PROGRAMMING LANGUAGES. Kenny Q. Zhu Dept. of Computer Science Shanghai Jiao Tong University

CS383 PROGRAMMING LANGUAGES. Kenny Q. Zhu Dept. of Computer Science Shanghai Jiao Tong University CS383 PROGRAMMING LANGUAGES Kenny Q. Zhu Dept. of Computer Science Shanghai Jiao Tong University KENNY Q. ZHU Research Interests: Programming Languages Probabilistic Programming Data Processing Concurrency

More information

CSE341: Programming Languages Lecture 17 Implementing Languages Including Closures. Dan Grossman Autumn 2018

CSE341: Programming Languages Lecture 17 Implementing Languages Including Closures. Dan Grossman Autumn 2018 CSE341: Programming Languages Lecture 17 Implementing Languages Including Closures Dan Grossman Autumn 2018 Typical workflow concrete syntax (string) "(fn x => x + x) 4" Parsing Possible errors / warnings

More information

Which of the following is not true of FORTRAN?

Which of the following is not true of FORTRAN? PART II : A brief historical perspective and early high level languages, a bird's eye view of programming language concepts. Syntax and semantics-language definition, syntax, abstract syntax, concrete

More information

Welcome to Python! Ilhoe Jung. Graphics & Media Lab

Welcome to Python! Ilhoe Jung. Graphics & Media Lab Welcome to Python! 2013. 07. 23 Ilhoe Jung Graphics & Media Lab Course schedule [Lecture 1] Introduction & Basic Grammar [Lecture 2] Data type & Class [Lecture 3] External libraries for python Introducing

More information

What is a compiler? var a var b mov 3 a mov 4 r1 cmpi a r1 jge l_e mov 2 b jmp l_d l_e: mov 3 b l_d: ;done

What is a compiler? var a var b mov 3 a mov 4 r1 cmpi a r1 jge l_e mov 2 b jmp l_d l_e: mov 3 b l_d: ;done What is a compiler? What is a compiler? Traditionally: Program that analyzes and translates from a high level language (e.g., C++) to low-level assembly language that can be executed by hardware int a,

More information

CS 314 Principles of Programming Languages

CS 314 Principles of Programming Languages CS 314 Principles of Programming Languages Lecture 16: Functional Programming Zheng (Eddy Zhang Rutgers University April 2, 2018 Review: Computation Paradigms Functional: Composition of operations on data.

More information