Programming Languages CSE 340 – Principles of Programming Languages Spring 2016 Adam Doupé Arizona State University

Slides:



Advertisements
Similar presentations
Compilers and Language Translation
Advertisements

Systems Software.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design First Edition by Tony Gaddis.
CS211 Data Structures Sami Rollins Fall 2004.
CS 110 Intro to Computer Science I Sami Rollins Fall 2006.
CS 101 Problem Solving and Structured Programming in C Sami Rollins Spring 2003.
Programming. Software is made by programmers Computers need all kinds of software, from operating systems to applications People learn how to tell the.
9-Aug-15 Vocabulary. Programming Vocabulary Watch closely, you might even want to take some notes. There’s a short quiz at the end of this presentation!
ANTLR.
Principles of Programming Chapter 1: Introduction  In this chapter you will learn about:  Overview of Computer Component  Overview of Programming 
CHAPTER 4: INTRODUCTION TO COMPUTER ORGANIZATION AND PROGRAMMING DESIGN Lec. Ghader Kurdi.
Python Mini-Course University of Oklahoma Department of Psychology Day 1 – Lesson 2 Fundamentals of Programming Languages 4/5/09 Python Mini-Course: Day.
Command line tools Manfred G. Grabherr. Overview -How do web-based tools work? -What is source code? -How to run things locally? -What is UNIX/Linux?
Topics Introduction Hardware and Software How Computers Store Data
High level & Low level language High level programming languages are more structured, are closer to spoken language and are more intuitive than low level.
INTRODUCTION TO COMPUTING CHAPTER NO. 06. Compilers and Language Translation Introduction The Compilation Process Phase 1 – Lexical Analysis Phase 2 –
COP4020 Programming Languages
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.
Chapter 10: Compilers and Language Translation Invitation to Computer Science, Java Version, Third Edition.
1 Programming Languages Tevfik Koşar Lecture - II January 19 th, 2006.
Lexical Analysis CSE 340 – Principles of Programming Languages Fall 2015 Adam Doupé Arizona State University
Java Programming Introduction & Concepts. Introduction to Java Developed at Sun Microsystems by James Gosling in 1991 Object Oriented Free Compiled and.
Compiler Construction1 COMP Compiler Construction Lecturer: Dr. Arthur Cater Teaching Assistant:
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.
CST320 - Lec 11 Why study compilers? n n Ties lots of things you know together: –Theory (finite automata, grammars) –Data structures –Modularization –Utilization.
Python From the book “Think Python”
2-1 Hardware CPU Memory - 2 kinds Network Graphics Input and Output Devices.
Basic of Programming Language Skill Area Computer System Computer Program Programming Language Programmer Translators.
Parse & Syntax Trees Syntax & Semantic Errors Mini-Lecture.
Compiler design Lecture 1: Compiler Overview Sulaimany University 2 Oct
3.2 Semantics. 2 Semantics Attribute Grammars The Meanings of Programs: Semantics Sebesta Chapter 3.
Programming Languages
CS Computer Science I. BCPL was developed in 1967 as a language for writing operating systems and software compilers In 1970, the creators of the.
Compiler Construction Composed By, Muhammad Bilal Qureshi.
Compilers I CNS History Wires Wires Machine Language Machine Language FFBA FFBA No Translation necessary No Translation necessary Assembly Language.
CHAPTER 1: Introduction to Computers and Programming CSEB113 PRINCIPLES of PROGRAMMING CSEB134 PROGRAMMING I by Badariah Solemon 1BS (May 2012)
1 Compiler & its Phases Krishan Kumar Asstt. Prof. (CSE) BPRCE, Gohana.
Principles of Programming Chapter 1: Introduction  In this chapter you will learn about:  Overview of Computer Component  Overview of Programming 
C H A P T E R T W O Linking Syntax And Semantics Programming Languages – Principles and Paradigms by Allen Tucker, Robert Noonan.
What is a compiler? –A program that reads a program written in one language (source language) and translates it into an equivalent program in another language.
CSCE 314 Programming Languages
Dr. Mohamed Ramadan Saady 314ALL CH1.1 Chapter 1: Introduction to Compiling.
Compiler Construction CPCS302 Dr. Manal Abdulaziz.
CSC 4181 Compiler Construction
ICS312 Introduction to Compilers Set 23. What is a Compiler? A compiler is software (a program) that translates a high-level programming language to machine.
Compilers and Interpreters
Overview of Compilation Prepared by Manuel E. Bermúdez, Ph.D. Associate Professor University of Florida Programming Language Principles Lecture 2.
OCR A Level F453: The function and purpose of translators Translators a. describe the need for, and use of, translators to convert source code.
Software Engineering Algorithms, Compilers, & Lifecycle.
Machine Language Computer languages cannot be directly interpreted by the computer – they are not in binary. All commands need to be translated into binary.
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 TO COMPILER SUNG-DONG KIM, DEPT. OF COMPUTER ENGINEERING, HANSUNG UNIVERSITY.
Advanced Computer Systems
Component 1.6.
Problem Identification
Overview of Compilation The Compiler Front End
Overview of Compilation The Compiler Front End
A451 Theory – 7 Programming 7A, B - Algorithms.
TRANSLATORS AND IDEs Key Revision Points.
Assembler, Compiler, Interpreter
Mobile Development Workshop
Assembler, Compiler, Interpreter
ICT Programming Lesson 1:
CISC 7120X Programming Languages and Compilers
Chapter 10: Compilers and Language Translation
1.3.7 High- and low-level languages and their translators
WJEC GCSE Computer Science
Function of Operating Systems
Presentation transcript:

Programming Languages CSE 340 – Principles of Programming Languages Spring 2016 Adam Doupé Arizona State University

Adam Doupé, Principles of Programming Languages What is a programming language? A structured way to define computation Is this the only definition/purpose? –Communicate an algorithm –Describe a process –Communicate a system to another person –Communicate instructions to a machine 2

Adam Doupé, Principles of Programming Languages How does the hardware understand your instructions? NO! 3

Adam Doupé, Principles of Programming Languages How does the computer understand your instructions? The CPU understands assembly language 4

Adam Doupé, Principles of Programming Languages How does the computer understand your instructions? Programs translate your intentions to the assembly language that the CPU understands Compilers –Translate programming language to executable binary Interpreters –Understand a programming language and perform the actual computation Transpiler –Translate a programming language to another programming language 5

Adam Doupé, Principles of Programming Languages How do they work? In this class, we will study how these programs are able to translate a high-level programming language into something the computer can understand Theory –Enables us to define what we can and cannot do when defining a programming language Practice –Empowers us to develop domain-specific languages, task-specific compilers, static analysis, parsing … 6

Adam Doupé, Principles of Programming Languages BF [>++++[>++>+++>+++>+ +>+>->>+[ >.> >>. >+.>++. Output: Hello World! 7

Adam Doupé, Principles of Programming Languages 8

Whitespace ____\n___\t__\t___\n\t\t____\t\n___\t\t__\t_\t\n\t\t____\t_\n___\t\t_\t\t__\n\t\t____\t\t\n___\t\t_\t\t __\n\t\t____\t__\n___\t\t_\t\t\t\t\n\t\t____\t_\t\n___\t_\t\t__\n\t\t____\t\t_\n___\t_____\n\t\t____\t\t\ t\n___\t\t\t_\t\t\t\n\t\t____\t___\n___\t\t_\t\t\t\t\n\t\t____\t__\t\n___\t\t\t__\t_\n\t\t____\t_\t_\n___\t\t _\t\t__\n\t\t____\t_\t\t\n___\t\t__\t__\n\t\t____\t\t__\n___\t_____\n\t\t____\t\t_\t\n___\t\t_\t\t\t\t\n\t\ t____\t\t\t_\n___\t\t__\t\t_\n\t\t____\t\t\t\t\n___\t_____\n\t\t____\t____\n___\t\t\t__\t\t\n\t\t____\t_ __\t\n___\t\t\t____\n\t\t____\t__\t_\n___\t\t____\t\n\t\t____\t__\t\t\n___\t\t___\t\t\n\t\t____\t_\t__\ n___\t\t__\t_\t\n\t\t____\t_\t_\t\n___\t\t\t__\t\t\n\t\t____\t_\t\t_\n___\t____\t\n\t\t____\t_\t\t\t\n____ \n\t\t_____\n\n_\t_\t\t\t_\t\t\t_\t\t\t__\t__\t\t_\t__\t_\t\t\t_\t___\t\t__\t_\t\n\n_\t_\t\t_\t\t\t__\t\t__\t_\t_\ t\t\t_\t\t\t_\t\t_\t\t___\t\t_\t__\t_\t\t_\t\t\t__\t\t__\t_\t\n\n\n\n\n___\t\t____\t_\t\t__\t___\t\t__\t__\n\t_ __\n\t\n\n___\t\t\t_\t\t\t_\t\t\t__\t__\t\t_\t__\t_\t\t\t_\t___\t\t__\t_\t\n_\n_\t\t\t_\n_\n\t__\t\t\t_\t\t\t_\t\t\ t__\t__\t\t_\t__\t_\t\t\t_\t___\t\t__\t_\t_\t_\t\t\t\t\t_\t\t__\t_\t_\t\t_\t\t\t__\t\t__\t__\n\t\n_____\t\n\t___ \n_\n_\t\t\t_\t\t\t_\t\t\t__\t__\t\t_\t__\t_\t\t\t_\t___\t\t__\t_\t\n\n___\t\t\t_\t\t\t_\t\t\t__\t__\t\t_\t__\t_\t\t \t_\t___\t\t__\t_\t_\t_\t\t\t\t\t_\t\t__\t_\t_\t\t_\t\t\t__\t\t__\t__\n_\n\n_\n\n\n\t\n\n___\t\t\t__\t__\t\t__\t _\t_\t\t____\t_\t\t__\t__\n_\n__\n_\t\n\t_\t\t\t_\n____\t_\t_\n\t__\t\n\t__\t\t\t__\t__\t\t__\t_\t_\t\t___ _\t_\t\t__\t___\t_\t\t\t\t\t_\t\t__\t_\t_\t\t_\t\t\t__\t\t__\t__\n_\n\n___\t\n\t___\n_\n_\t\t\t__\t__\t\t__\t_ \t_\t\t____\t_\t\t__\t__\n\n___\t\t\t__\t__\t\t__\t_\t_\t\t____\t_\t\t__\t___\t_\t\t\t\t\t_\t\t__\t_\t_\t\t_\t\t \t__\t\t__\t__\n_\n\n___\t\n\t_______\n\t\t_\n\t\n\n___\t\t_\t\t\t__\t\t__\t_\t_\t\t\t_\t\t\t_\t\t_\t\t___\t\t _\t__\t_\t\t_\t\t\t__\t\t__\t_\t\n___\t_\t_\n___\t\t_\t\n\t\n__\t\n__\n\t\n Output: Hello, world of spaces! 9

Adam Doupé, Principles of Programming Languages Python print "Hello World!" 10

Adam Doupé, Principles of Programming Languages Haskell module Main where main = putStrLn "Hello, World!" 11

Adam Doupé, Principles of Programming Languages x86 Assembly global _start section.text_start: mov rax, 1 mov rdi, 1 mov rsi, message mov rdx, 13 syscall mov eax, 60 xor rdi, rdi syscall message: db "Hello, World", 10 12

Adam Doupé, Principles of Programming Languages Which is actually a PL? All of them? None of them? Some of them? 13

Adam Doupé, Principles of Programming Languages Computation x86 binary Overview of Program Interpretation Source Lexer Tokens Parser Semantic Analysis Parse Tree Valid Parse Tree Bytes 14 Backend Valid Parse Tree

Adam Doupé, Principles of Programming Languages What makes a program valid? Syntax –What does it mean to look like a valid program? Semantics –What does it mean for a program to be valid? Correctness? –Is the program the correct one for the job? 15