Login   Register  
PHP Classes
elePHPant
Icontem

File: SQL/sql.grammar.txt

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Richard Keizer  >  Pragmatic BNF-a-like parser  >  SQL/sql.grammar.txt  >  Download  
File: SQL/sql.grammar.txt
Role: Auxiliary data
Content type: text/plain
Description: sql grammar
Class: Pragmatic BNF-a-like parser
Parse language source with a BNF grammar syntax
Author: By
Last change: grammar tweak
Date: 3 years ago
Size: 1,825 bytes
 

Contents

Class file image Download
root ::= query

query ::= deletequery
query ::= selectquery

selectquery ::= selectstatement fieldlist from dataref where searchcondition
selectquery ::= selectstatement fieldlist from dataref
selectquery ::= selectstatement fieldlist

deletequery ::= deletestatement from tableref where searchcondition
deletequery ::= deletestatement from tableref

deletestatement ::= 'DELETE'
selectstatement ::= 'SELECT'

fieldlist ::= field listseparator fieldlist
fieldlist ::= field

listseparator ::= comma


field ::= '[*]'
field ::= string

where ::= 'WHERE'


OR ::= 'OR'
AND ::= 'AND'
NOT ::= 'NOT'
IN ::= 'IN'

searchcondition ::= booleanvalueexpr


booleanvalueexpr ::= booleanterm OR booleanvalueexpr
booleanvalueexpr ::= booleanterm

booleanterm ::= booleanfactor AND booleanterm
booleanterm ::= booleanfactor

booleanfactor ::= NOT booleanprimary
booleanfactor ::= booleanprimary

booleanprimary ::= leftparen searchcondition rightparen
booleanprimary ::= predicate


predicate ::= comparisonpredicate
predicate ::= inpredicate


inpredicate ::= variable IN leftparen inlist rightparen
inlist ::= factor listseparator inlist
inlist ::= factor


comparisonpredicate ::= expression compop expression

compop ::= '<>|<=>|>=|<=|==|=|!='

expression ::= term addop expression
expression ::= term

addop ::= '[+-]'

term ::= factor multop term
term ::= factor

multop ::= '[*]'

factor ::= text
factor ::= variable
factor ::= number


variable ::= '[a-zA-Z][a-zA-Z0-9_]*'

leftparen ::= '\('
rightparen ::= '\)'


from ::= 'FROM'
dataref ::= selectquery
dataref ::= tableref
tableref ::= databasename period tablename
tableref ::= tablename
tablename ::= string
databasename ::= string

alphanumeric ::= '[a-zA-Z]'


string ::= '[a-zA-Z]+'
text ::= '\".+\"'

period ::= '[.]'
comma ::= '[,]'

digit ::= '[0-9]'
number ::= '[0-9]+'