Download presentation
Presentation is loading. Please wait.
1
Welcome to Programming Languages!
2
Why take Programming Languages?
Make me a better ________________
3
Why take Programming Languages?
Make be a better creator of PLs Design PLs Implement PLs Make me a better user of PLs Write better code Choose right PL for job
4
Deep questions What makes a good PL design?
What types of PL designs are there? How do you implement a PL?
5
Can you guess what this is?
It’s a program! Machine language – x86 (Pentium) Expressed as hex Calculates greatest common divisor (GCD) It’s a program! It calculates the greatest common divisor (GCD) of two integers. Can you guess what language? It’s machine language (expressed as hex) for the x86 (Pentium) instruction set.
6
What are the pros/cons of machine language?
Close to machine Performance Unreadable Not portable More???
7
Can you guess what this is?
Assembly language version of GCD program 1-to-1 mnemonic mapping to machine language
8
What are the pros/cons of assembly language?
Pretty much same as machine language, but more human readable
9
Can you guess what this is?
High-level language (C/C++) version of GCD
10
What are the pros/cons of high-level language?
Pros: More comprehendible, scalable, and portable Cons: Farther from the machine (poorer performance)
11
But there are thousands(
But there are thousands(?) of high-level langs – what makes one better than another? C/C++ Scheme/Lisp Prolog
12
What makes one lang better than another?
Expressive power What computations can you express? Usability Learnability Ease of use (create/read/modify) Ease of implementation Performance Tool support Familiarity/expertise???
13
Deep questions What makes a good PL design?
What types of PL designs are there? How do you implement a PL?
14
Declarative versus Imperative
Say what to compute Programmers point of view Higher level Up and coming Say how to compute Implementers point of view Closer to machine Dominant
15
(Fuzzy) Categories of languages
Declarative functional (Lisp/Scheme, ML, Haskell) dataflow (Id, Val) logic, constraint-based (Prolog, spreadsheets) template-based (XSLT) Imperative von Neumann (C, Ada, Fortran, …) scripting (Perl, Python, PHP, …) object-oriented (Smalltalk, Eiffel, Java, …)
16
Functional versus von Neuman
Functional - Scheme/Lisp Recursive definition of functions, refining from more complex to simpler (no variables/state!) von Neumann - C/C++ Declaration and sequential modification of variables
17
Deep questions What makes a good PL design?
What types of PL designs are there? How do you implement a PL?
18
Finish this dataflow diagram for assembly language
???
19
Finish this dataflow diagram for assembly language
20
Finish this dataflow diagram for high-level languages
???
21
Finish this dataflow diagram for high-level languages
Don’t let the names confuse you. These are all translators
22
Architectural pattern
Architectural pattern*: Translate through many intermediate representations * Called pipeline or pipes and filters architecture
23
But there’s another way!
Can you explain this diagram?
24
Translators Versus Interpreters
Translator: Program that reads “sentences” in one language and converts them to another See also compilers, assemblers Interpreter: Program that reads sentences in some language and “executes” them May or may not be interactive
25
What language uses this translator/interpreter hybrid architecture?
aka Compiler aka Interpreter Why, Java, of course
26
How do you read/analyze/process code?
… What happens in here?
27
Two big concerns Syntax: The form in which sentences are expressed
What syntactic elements do parts of the source map to? Is the source syntactically valid? Semantics: The meaning of the sentences What semantic elements do parts of the source map to? Is the source semantically valid?
28
What to do first?
29
Split input into bite-size tokens
C/C++ token examples: What next?
30
Map tokens to syntactic elements
C/C++ parse tree example: What next?
31
Represent program in terms of semantic elements
AST example What next?
32
And all the rest… And all the rest…
33
Fortunately, there are tools to help you!
Compiler Compilers aka Compiler Generators aka Parser Generators aka… Examples: Lex/Yacc Flex/Bison ANTLR
34
Course Goals Learn to create your own language translators/interpreters Using ANTLR Survey issues and features in PL design Try programming in sampling of different languages
35
Course Structure Three parts (4-5 weeks each)
Follows structure of PLP book Each ends in an exam Homeworks throughout (~7) Readings + quizzes throughout
36
Grading 51% exams (3 x 17%) 39% homeworks and quizzes
10% participation
37
Some key policies No cheating!
I use plagiarism detection system! Participate! (lest you lose a participation point) Be here at beginning of class, stay until the end Pop quizzes at beginning of class common Be engaged! Expect seating chart Bring laptops, but…
39
Let’s tour the course web pages…
40
What’s next? Take Java proficiency instrument Do Homework 0
In class today Do Homework 0 Due Tuesday by 2:40
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.