static-analysis

How to output the AST built using ANTLR?

∥☆過路亽.° 提交于 2019-11-26 00:33:09
问题 I\'m making a static analyzer for C. I have done the lexer and parser using ANTLR in which generates Java code. Does ANTLR build the AST for us automatically by options {output=AST;} ? Or do I have to make the tree myself? If it does, then how to spit out the nodes on that AST? I am currently thinking that the nodes on that AST will be used for making SSA, followed by data flow analysis in order to make the static analyzer. Am I on the right path? 回答1: Raphael wrote: Does antlr build the AST

How to perform static code analysis in php? [closed]

☆樱花仙子☆ 提交于 2019-11-26 00:23:08
问题 Is there an static analysis tool for PHP source files? The binary itself can check for syntax errors, but I\'m looking for something that does more, like: unused variable assignments arrays that are assigned into without being initialized first and possibly code style warnings ... 回答1: Run php in lint-mode from the command line to validate syntax without execution: php -l FILENAME Higher-level static analyzers include: php-sat - Requires http://strategoxt.org/ PHP_Depend PHP_CodeSniffer PHP