Menu

Syntax_analysis

silex6

At syntax analysis step, the SQL parser should do a token based analysis and extract the nested blocks structure (phrases) of the SQL instruction flow. This should be implemented by dynamically building a tree that represents the instruction flow to be analysed. Every node in the tree should correspond to a single phrase construct (as instructions with parameters, predicates, expression terms ...).

Due to SQL syntax, many block constructs have no end keyword, and sometimes have no start keyword, this have the impact that an implicit block end should be processed at time a keyword token has been reached that corresponds to a neighbour instruction of any level of the currently processed operations tree. This could be implemented by adding a 'parent' reference to every object of the three structure, and use this reference to do a top-down cascade call of an 'end of block' check function.

The exact way to analyse token flow differ for every SQL instruction. Depending on the calling context (client request, stored procedure or trigger), some instructions can be made unavailable, hence the semantic analysis object should pre-build a list of enabled instructions in current context before to start instruction flow analysis

See also

[SQL_Parser]


Related

Wiki: SQL_Parser

MongoDB Logo MongoDB