
On Static Analysis + LLM
Static analysis is understanding your code before running it. def add ( a , b ): return a + b def main (): return add ( 1 , 3 ) Above is a trivial program. At a glance, you can tell that calling main() will return 4 . Here are some questions to ponder about: What happens if you call add with non-numeric types? i.e. what does add("foo", "bar") return? How do you know about the above? Static analysis is about answering these questions without having to run the code. As human programmers, we develop familiarity with the language and runtime. This lets us answer such questions easily. But how does a machine figure out the answer? Programs have many representations (the human-friendly syntax being one of many). Here are some other ways to also represent the above python program: AST Module( body=[ FunctionDef( name='add', args=arguments( args=[ arg(arg='a'), arg(arg='b')]), body=[ Return( value=BinOp( left=Name(id='a'), op=Add(), right=Name(id='b')))]), FunctionDef( name='main', args=argume
Continue reading on Dev.to Python
Opens in a new tab




