public static void main(String[] args) throws Exception { LBP.put("=", 7); LBP.put("and", 5); LBP.put("or", 5); LBP.put("<", 7); LBP.put(">", 7); LBP.put("+", 10); LBP.put("-", 10); LBP.put("*", 20); LBP.put("/", 20); LBP.put("(", 100); LBP.put(")", 1); PrattParser p = new PrattParser(); p.debug = true; Reader reader = (new StringReader("-a * -b")); p.lexer = new LookaheadLexerWrapper(new StructuredLexer(new BaseLexer(reader), " ")); // p.advance(); Expr ast = p.expr(0); System.out.println(ast); }