
Principles of Programming Languages: Understanding How Computers Process Instructions
Explore the fundamentals of programming languages with insights on how instructions are communicated to computers, the role of assembly language, and the translation processes involved. Discover how theory and practice empower the development of compilers and domain-specific languages.
Download Presentation

Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.
E N D
Presentation Transcript
Programming Languages CSE 340 Principles of Programming Languages Fall 2015 Adam Doup Arizona State University http://adamdoupe.com
What is a programming language? A way to communicate instructions to a machine Is this the only definition/purpose? Communicate an algorithm Describe a process Communicate a system to another person 2 Adam Doup , Principles of Programming Languages
How does the computer 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 Translate and execute a programming language 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, 6 Adam Doup , Principles of Programming Languages
BF ++++++++[>++++[>++>+++>+++>+<<<<- ]>+>+>->>+[<]<-]>>.>--- .+++++++..+++.>>.<-.<.+++.------.-- ------.>>+.>++. Output: Hello World! http://www.iwriteiam.nl/Ha_bf_online.html 7 Adam Doup , Principles of Programming Languages
8 Adam Doup , Principles of Programming Languages
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! https://github.com/hostilefork/whitespacers/ 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
Overview of Program Interpretation Valid Parse Tree Parse Tree Tokens Bytes Semantic Analysis Lexer Parser Source 14 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 Adam Doup , Principles of Programming Languages