GETTING STARTED WITH JSqlParser The goal of JSqlParser is to translate a SQL string into a hierarchy of Java classes, i.e. an abstract syntax tree. The syntax of SQL is quite complex, and so is the tree generated by JSqlParser. In the beginning it is a good idea to focus only on a small subset of constructs, and see how they get translated into a tree. We start from arithmetic expressions: the code below shows how to parse and process strings like "32+(21-4)". //----------------------------------------------------------------------------------------------------- package edu.buffalo.cse562.sql.expression; import java.io.StringReader; import net.sf.jsqlparser.expression.*; import net.sf.jsqlparser.parser.*; public class ExpressionExample { public static void main(String[] args) throws ParseException { String str = "1-(3+2)"; Expression arithmeticExpr = parseArithmeticExpression(str); SimpleCalculator calculator = new SimpleCalculator(); arithmeticExpr.accept(calculator); System.out.println(str+" = "+calculator.getResult()); } /** * * Parse something like "(3+2)-A" * * @param exprStr * @return * @throws ParseException */ public static Expression parseArithmeticExpression(String exprStr) throws ParseException { CCJSqlParser parser = new CCJSqlParser(new StringReader(exprStr)); return parser.SimpleExpression(); } /** * * Parse something like "A