Download presentation
Presentation is loading. Please wait.
Published byBarnaby Dickerson Modified over 6 years ago
1
CSc 453 Compilers & Systems Software 00. Background
Saumya Debray The University of Arizona Tucson, AZ 85721
2
Course Objectives + Get experience with a large software project
Understand the design and implementation of compilers and related systems software. Understand how source language programs are implemented at the machine level. Understand compilation as an instance of language translation. + Get experience with a large software project CSc 453: Background
3
Compilers A compiler (more generally, translator) maps source language strings to “equivalent” target language strings. E.g.: gcc : C/C++ programs to assembly/machine code latex2html: Latex documents to HTML javac : Java programs to JVM byte code ps2pdf: PostScript files to PDF files CSc 453: Background
4
Languages Syntax: Semantics: “structural” aspects of program units.
specified by a grammar. Semantics: the “meaning,” i.e., behavior, of program units. specified using actions associated with grammar rules. CSc 453: Background
5
Structure of a compiler
6
Structure of a compiler (“phases”)
CSc 453: Background
7
Structure of a compiler (“phases”)
high-level IR (syntax trees) low-level IR (3-addr code) CSc 453: Background
8
Structure of a compiler (“phases”)
Front end high-level IR (syntax trees) low-level IR (3-addr code) Back end CSc 453: Background
9
Phases of a Compiler Lexical analysis (“scanning”)
Reads in program, groups characters into “tokens” Syntax analysis (“parsing”) Structures token sequence according to grammar rules of the language. Semantic analysis Checks semantic constraints of the language. Intermediate code generation Translates to “lower level” representation. Program analysis and code optimization Improves code quality. Final code generation. CSc 453: Background
10
Grouping of Phases Front end : machine independent phases
Lexical analysis Syntax analysis Semantic analysis Intermediate code generation Some code optimization Back end : machine dependent phases Final code generation Machine-dependent optimizations CSc 453: Background
11
A commonly used translator: The Web Browser
Gecko (rendering engine for Firefox): Webkit (rendering engine for Safari and Chrome): back end front end front end back end Source: How Browsers Work: Behind the Scenes of Modern Web Browsers, by Tali Garsiel & Paul Irish. CSc 453: Background
12
The programming project
13
The programming project
syntax tree annotated syntax tree compiler scanner + parser type checker code generator source code target code Assg 1 learn the API given you write Assg 2 Assg 3 learn lex and yacc Assg 4 given you write you have written Assg 5 you write you have written
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.