Use antlr to get a tree view of a Java piece of code
Let this loop be (save it under ~/workdir/LoopOne.java):
class LoopOne { public static void main(String[] args) { float x = Float.parseFloat(args[0]); while ( 0 - x <= 0){ x = x - 1; } } }
If you want to get it parsed, you can use Antlr (http://www.antlr.org/)
cd ~/workdir
curl -O http://www.antlr.org/download/antlr-4.5-complete.jar curl -O https://raw.githubusercontent.com/antlr/grammars-v4/master/java8/Java8.g4
In ".bashrc":
export CLASSPATH=".:/home/mrakotomandimby/workdir/antlr-4.5-complete.jar:$CLASSPATH" alias antlr4='java -Xmx500M -cp ".:/home/mrakotomandimby/workdir/antlr-4.5-complete.jar:$CLASSPATH" org.antlr.v4.Tool' alias grun='java org.antlr.v4.runtime.misc.TestRig'
antlr4 Java8.g4 javac LoopOne.java Java8*.java grun Java8 compilationUnit -tree LoopOne.java grun Java8 compilationUnit -gui LoopOne.java