-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLanguage.txt
32 lines (26 loc) · 1.38 KB
/
Language.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
Select A, B, C From X Where A = '1' AND B <> 2
Insert Into X Set A = '1', B = 2, C = 'C'
Update X Set A = '2' Where A = '1'
Delete From X Where A = '1'
Create Table X (A String(50) Index, B Int, C String(5))
Drop Table X
StatementList = StatementList, Statement | Statement ;
Statement = SelectStmt | InsertStmt | UpdateStmt | DeleteStmt | CreateStmt | DropStmt ';' ;
SelectStmt = 'Select', FieldList, 'From', Identifier, ['Where', ComparisonGroup] ;
InsertStmt = 'Insert Into', Identifier, 'Set', AssignmentList ;
UpdateStmt = 'Update', Identifier, 'Set', AssignmentList, 'Where', ComparisonGroup ;
DeleteStmt = 'Delete From', Identifier, 'Where', ComparisonGroup ;
CreateStmt = 'Create Table', Identifier, '(', ColumnSpecList, ')' ;
DropStmt = 'Drop Table', Identifier ;
ColumnSpecList = ColumnSpec | ColumnSpecList, ',', ColumnSpec ;
ColumnSpec = Identifier, ColumnType | Identifier, ColumnType, ColumnOption ;
ColumnType = 'String', '(', integer, ')' | 'Int' | 'Integer' ;
ColumnOption = 'Index' ;
FieldList = Identifier | FieldList, ',', Identifier ;
AssignmentList = Assignment | AssignmentList, ',', Assignment ;
Assignment = Identifier, '=', Value ;
ComparisonGroup = Comparison | ComparisonList, 'AND', Comparison
Comparison = Identifier, Comparator, Value;
Comparator = '=' | '<>';
Identifier = { letter, '_' } , { letter | digit | '_' } ;
Value = "'", string, "'" | '"', string, '"' | integer ;