1

how to code a semantic tree for an equation like this : x=y+5

in java:

public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    System.out.println("Please Enter Your String");
    String x = sc.nextLine();
    for (int j = 0; j < x.length(); j++) {
        char m = x.charAt(j);
        System.out.println("Level "+(j+1)+" is "+m);
    }
}
Ludovic Feltz
  • 11,416
  • 4
  • 47
  • 63
  • 1
    Check this out: http://stackoverflow.com/questions/4589951/parsing-an-arithmetic-expression-and-building-a-tree-from-it-in-java – Diana Amza Dec 08 '14 at 12:04

0 Answers0