Static & Syntactic Analysis Flashcards
Stuff you can do with an AST (syntactic analysis-y things)
- build a call graph
- build a def-use chain
- build a flowchart (tiny bit semantic)
Def-use chain: definition
links uses of a symbol to the definition of that symbol
=> becomes chain when a new symbol is partially defined by an existing symbol
Control flow analysis: definition
static code analysis technique for determining control flow of a diagram
Data flow analysis: definition
gathering information about the possible set of values calculated at various points in a computer program
Why can’t you create a def-use chain with lexical analysis?
Because you need to know the grammar of the code
Algorithm for creating a def-use chain
at the def site: record name of the variable in the map along with its line number
at the use site: link use to last def for that variable