Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
Roseseed
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Wanxin Li
Roseseed
Commits
96024581
Commit
96024581
authored
5 years ago
by
Wanxin Li
Browse files
Options
Downloads
Patches
Plain Diff
fix term
parent
34bd0871
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
SQLPGrammar_new.y
+19
-18
19 additions, 18 deletions
SQLPGrammar_new.y
SQLPParser_new.c
+37
-0
37 additions, 0 deletions
SQLPParser_new.c
SQLPScanner_new.l
+2
-0
2 additions, 0 deletions
SQLPScanner_new.l
with
58 additions
and
18 deletions
SQLPGrammar_new.y
+
19
−
18
View file @
96024581
...
...
@@ -17,7 +17,8 @@
%token ON DETERMINED COVER QUERY GIVEN FROM SELECT WHERE ORDER
%token PRECOMPUTED ONE EXIST FOR ALL TRANSACTION INTCLASS STRCLASS
%token INTEGER REAL DOUBLEREAL STRING MAXLEN RANGE TO
%token INSERT END CHANGE DELETE DECLARE RETURN UNION
%token INSERT END CHANGE DELETE DECLARE RETURN UNION UNIONALL
%token ELIM LIMIT NJOIN
%start SQLPProgram
%%
...
...
@@ -74,7 +75,7 @@ BodyContent // create BodyContent since njoin does not apply to FROM
: TableList
{
printf("BodyContent 1\n");
$$ = $1
$$ = $1
;
}
| TableList WHERE Pred
{
...
...
@@ -84,20 +85,20 @@ BodyContent // create BodyContent since njoin does not apply to FROM
| '(' TableList ')' NJOIN BodyContent
{
printf("BodyContent 3\n");
$$ = create_njoin_operator($1, $3)
$$ = create_njoin_operator($1, $3)
;
}
| '(' TableList WHERE Pred ')' NJOIN BodyContent
{
printf("BodyContent 3\n");
$$ = create_njoin_operator(create_eval_operator($4, $2), $6)
$$ = create_njoin_operator(create_eval_operator($4, $2), $6)
;
}
Body
: FROM BodyContent
{
printf("Body \n")
$$ = $2
printf("Body \n")
;
$$ = $2
;
}
;
...
...
@@ -105,7 +106,7 @@ TableList
: TableIdentifier VarIdentifier
{
printf("TableList 1\n");
$$ = create_rename_operator($1, $2);
s
$$ = create_rename_operator($1, $2);
}
| TableIdentifier VarIdentifier ',' TableList // keep right-recursive
{
...
...
@@ -126,10 +127,10 @@ UnionQuery
printf("UnionQuery 2\n");
$$ = create_union_all_operator($2, $5);
}
:
SelectQuery
|
SelectQuery
{
printf("UnionQuery 3\n");
$$ = $1
$$ = $1
;
}
;
...
...
@@ -139,13 +140,13 @@ SelectList
printf("SelectList 2\n");
$$ = create_rename_operator($1, NULL);
}
| Col
as
AttrIdentifier // todo: create_as_operator
| Col
AS
AttrIdentifier // todo: create_as_operator
| Col ',' SelectList
{
printf("SelectList 4\n");
$$ = create_rename_operator($1, $2);
}
| Col
as
AttrIdentifier ',' SelectList
| Col
AS
AttrIdentifier ',' SelectList
;
Col
...
...
@@ -226,12 +227,12 @@ Pred
: Conj
{
printf("Pred 1\n");
$$ = $1
$$ = $1
;
}
| Pred OR Conj
{
printf("Pred 2 \n");
$$ = create_or_operator($1, $3)
$$ = create_or_operator($1, $3)
;
}
...
...
@@ -239,7 +240,7 @@ Conj
: BasicPred
{
printf("Conj 1 \n");
$$ = $1
$$ = $1
;
}
| BasicPred AND Conj
{
...
...
@@ -263,24 +264,24 @@ BasicPred
| NOT BasicPred
{
printf("BasicPred 3 \n");
$$ = create_not_operator($2);
$$ = create_not_operator($2
, NULL
);
}
| '(' Pred ')'
{
printf("BasicPred 4\n");
$$ = $1
$$ = $1
;
}
Term
: Constant
{
printf("Term 1\n");
$$ =
create_constant(
$1
)
$$ = $1
;
}
| Col
{
printf("Term 2\n");
$$ =
create_col(
$1
)
$$ = $1
;
}
...
...
This diff is collapsed.
Click to expand it.
SQLPParser_new.c
0 → 100644
+
37
−
0
View file @
96024581
/*
* Copyright (C) 1989, G. E. Weddell.
*
* This file is part of RDM.
*
* RDM is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* RDM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with RDM. If not, see <http://www.gnu.org/licenses/>.
*/
#include
<stdio.h>
#include
"util.h"
#include
"lex.yy.c"
#include
"SQLPGrammar_new.tab.c"
int
main
()
{
int
Result
;
strcpy
(
LineBuffer
,
""
);
printf
(
"(
\n
"
);
Result
=
yyparse
();
if
(
Result
)
printf
(
"**error**"
);
else
fprintf
(
stderr
,
"checking semantics.
\n
"
);
printf
(
")
\n
"
);
return
(
Result
);
}
This diff is collapsed.
Click to expand it.
SQLPScanner_new.l
+
2
−
0
View file @
96024581
...
...
@@ -51,6 +51,7 @@ E [Ee][+-]?{D}+
"delete" { strcat(LineBuffer, yytext); return(DELETE); }
"desc" { strcat(LineBuffer, yytext); return(DESC); }
"union" { strcat(LineBuffer, yytext); return(UNION); }
"unionall" { strcat(LineBuffer, yytext); return(UNIONALL); }
"determined" { strcat(LineBuffer, yytext); return(DETERMINED); }
"distributed" { strcat(LineBuffer, yytext); return(DISTRIBUTED); }
"dynamic" { strcat(LineBuffer, yytext); return(DYNAMIC); }
...
...
@@ -61,6 +62,7 @@ E [Ee][+-]?{D}+
"from" { strcat(LineBuffer, yytext); return(FROM); }
"given" { strcat(LineBuffer, yytext); return(GIVEN); }
"has" { strcat(LineBuffer, yytext); return(HAS); }
"njoin" { strcat(LineBuffer, yytext); return(NJOIN); }
"implies" { strcat(LineBuffer, yytext); return(IMPLIES); }
"index" { strcat(LineBuffer, yytext); return(INDEX); }
"insert" { strcat(LineBuffer, yytext); return(INSERT); }
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment