Menu

SQLParser_Implemented

silex6
There is a newer version of this page. You can find it here.

SQL Parser

Goal of the SQL parser is to convert some SQL source code to an internal representation. The current implementation convert the source code to a set of objects using classes implemented in the runtime package.

The current implementation use the ANTLR tool - a parser generator. With ANTLR, a configuration file define the vocabulary and the grammar rules for the language. The tool then generate the source code of the parser - the module that will parse a text and retrieve the different rules used in the SQL source code. When parsing a source text, the ANTLR runtime will call a visitor method for each grammar rules used in the source code. The visitor methods implemented in this package will create instances of runtime package classes to describe the SQL source code

SQL parser is included in org.whitebear.sql package and is currently under development

Main files

  • SqlVisitor interface that define the available visitor methods - interface file is generated by ANTLR
  • Translator, StatementTranslator, and ExpressionTranslator. Implements the interface above - the visitor methods that instantiate objects of the runtime package.
  • Sql.4g - the ANTLR grammar file. Describe the vocabulary - SQL keywords and symbols, as well as grammar rules - how to construct phrases in SQL

See also

http://www.antlr.org - ANTLR tool
SQL parser specification


MongoDB Logo MongoDB