package ch.bfh; import ch.bfh.lexer.LexerException; import ch.bfh.parser.ParserException; import ch.bfh.parser.StatementParser; import java.util.Scanner; public class Main { public static void main(String[] args){ Scanner scanner = new Scanner(System.in); StatementParser sp = new StatementParser(); while (true) { System.out.print("Type your expression: "); String expression = scanner.nextLine(); try { sp.parseStatement(expression); System.out.println("Result: " + sp.getValue()); } catch (LexerException | ParserException e) { System.out.println(e.getMessage()); } } } }