<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to SQL_Parser</title><link>https://sourceforge.net/p/whitebear/allura-wiki/SQL_Parser/</link><description>Recent changes to SQL_Parser</description><atom:link href="https://sourceforge.net/p/whitebear/allura-wiki/SQL_Parser/feed" rel="self"/><language>en</language><lastBuildDate>Tue, 27 May 2014 17:59:55 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/whitebear/allura-wiki/SQL_Parser/feed" rel="self" type="application/rss+xml"/><item><title>SQL_Parser modified by silex6</title><link>https://sourceforge.net/p/whitebear/allura-wiki/SQL_Parser/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v1
+++ v2
@@ -23,6 +23,12 @@

 ## Topics

+  * [Lexical_analysis] 
+  * [Syntax_analysis] 
+  * [Name_resolution] 
+  * [Type_checking_and_pre-calculation] 
+  * [Semantic_optimization] 
+
 ## See also

 [General_architecture] 
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">silex6</dc:creator><pubDate>Tue, 27 May 2014 17:59:55 -0000</pubDate><guid>https://sourceforge.net52c4043de23922bf886cb83e9fbd3c6a6cb7e494</guid></item><item><title>SQL_Parser modified by silex6</title><link>https://sourceforge.net/p/whitebear/allura-wiki/SQL_Parser/</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;The &lt;strong&gt;SQL parser&lt;/strong&gt; should be a library component that inputs SQL instruction flows and do some compiler-like analysis in order to transform the instructions into a platform independent operation tree structure (so-called "binary code") that will be used by the set runtime. Typical compilation sequence is to process lexical analysis of the word contained in source text, then process syntax analysis of the phrase of the source code, and then challenge the actual sense of the source code by checking type compatibility and identifier names. &lt;/p&gt;
&lt;p&gt;An operation tree structure should be built as a compound object that reflects a single SQL instruction. And an SQL procedure or script code should be a flow of operation trees. The tree compound object should be built using SQL framework class collection: a set of active objects that reflect SQL instructions. Active mean code of every framework object should allow execution of the underlying SQL instruction. &lt;/p&gt;
&lt;p&gt;An instance of the SQL parser should be loaded by the client API for every worker thread and should be used to prepare and run SQL requests sent by clients. The SQL parser should also be used to compile stored procedures, methods and triggers. Both source code and binaries (operation trees) of triggers and procedures should be stored into the database. &lt;/p&gt;
&lt;p&gt;The SQL parser should run into four steps: lexical analysis, syntax analysis (operation tree build), semantic analysis and optimization. The lexical analysis should produce a flow of words that should be converted to a tree by the syntax analysis and should then be refined by several operations in order to become executable. &lt;/p&gt;
&lt;p&gt;The main operations done during lexical analysis should be to extract words that are part of the SQL source code. The word should be then analysed in order to retrieve keywords, in-line constants (literals) and identifiers. Comments will be removed during this step as they are neither keywords nor constants nor identifiers. &lt;/p&gt;
&lt;p&gt;There should be 27 classes related to lexical elements. Those classes will be used to identify and describe SQL lexical elements. Those should be passive classes that are intended to describe result of lexical analysis only. &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;the classes should be: keyword, reserved word, numeric literal, string literal, binary literal, boolean literal, datetime literal, timespan literal (SQL interval), identifier, percent, ampersand, start parentheses, end parentheses, asterisk, comma, period, solidus, colon, semicolon, less, equals, greather, question, start bracket, end bracket, underscore, bar. &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The main operations done during syntax analysis should be to build the execution tree by retrieval of phrases and sentences that are part of the SQL source code. Keywords should be used as a basis to decode phrase structure and build matching tree nodes. &lt;/p&gt;
&lt;p&gt;The main operations done during semantic analysis should be to check if the build tree actually makes sense, and should convert abstract tree to an executable form. Internal IDs of the objects (as table names, field names) should be retrieved; pre-calculation of expressions should be run in order to determine data types of results of the expressions that are part of the build tree, and check for type compatibility between expression elements should be performed. &lt;/p&gt;
&lt;p&gt;The main operations done during optimization should be to pre-calculate constant expressions, as well as to clean, and transform current operation tree nodes to equivalent nodes that will be faster to process on current database engine implementation. &lt;/p&gt;
&lt;p&gt;Lexical and syntax analysis could use the ANTLR compiler builder package. This code generator allows automatic generation of lexical and syntax analyzer code. It does support SQL as source language (language to compile) and C, C++, C#, Java and Python as target (language to implement compiler). &lt;/p&gt;
&lt;h2 id="topics"&gt;Topics&lt;/h2&gt;
&lt;h2 id="see-also"&gt;See also&lt;/h2&gt;
&lt;p&gt;&lt;a class="alink" href="/p/whitebear/allura-wiki/General_architecture/"&gt;[General_architecture]&lt;/a&gt; &lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">silex6</dc:creator><pubDate>Tue, 27 May 2014 17:59:55 -0000</pubDate><guid>https://sourceforge.net77bd7ec69678bb6d237e100e3a5d00558d9201f0</guid></item></channel></rss>