You are on page 1of 12

Basic Discrete Mathematics and

Compiler Knowledge
CS 599: Program Analysis and
Software Testing
Lecture 2
The Basics
• Software debugging is performed on the
software artifact
• Generally, the artifact is produced by a
compiler
• Debugging techniques need assurances of
correctness

2
Intermediate Representation
Source program Lexical Tokens
analyzer Parser
(stream of char.)

Intermediate
representation

Code generation,
optimization

Target
code

3
Java vs. C++ Example

Language Compiler Target IR


Java Javac Java bytecode
C++ Gcc Binary executable
.NET Visual Studio Common Intermediate
Language

4
Levels of Analysis
• Local: within a single basic block or statement
• Global, Intraprocedural: within a single procedure,
function, or method (sometimes, intramethod)
• Interprocedural: across procedure boundaries,
procedure call, shared globals, etc.
• Intraclass: within a single class
• Interclass: across class boundaries
• Intramodule: within a single module

5
Discrete Math Overview
• Sets: Definitions, Operations
• Graphs: Representation, Paths
• Trees: Representation, Traversals

6
Set – Basic Definitions
• What is a set?
– Elements
– Membership
• What is a subset?
• The empty set

7
Set - Operations
• Common operations
– Union
– Intersection
– Difference
• Set negation
• Cartesian product

8
Graphs - Representation
• Edges and nodes
• Set representation of graphs
• Sub graphs
• Directed graphs
• Acyclic graphs
• Definition of a path

9
Trees - Representation

• What is a tree?
• Parts of the tree:
– Root
– Leaves

10
Trees – Traversals
• Standard traversals
– In-order
– Pre-order
– Post-order
• Depth first vs. breadth first

11
Algorithms vs. Heuristics

• What is an algorithm?
• What is a heuristic?
• What is the difference?
• Assurances of correctness?

12

You might also like