-
Notifications
You must be signed in to change notification settings - Fork 0
/
gram.y
51 lines (39 loc) · 842 Bytes
/
gram.y
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
%{
package parser
import (
"fmt"
)
type Node struct {
}
%}
%union{
node *Node
str string
ival int
}
%token
%left '-' '+'
%left '*' '/'
%type <node> statement
/*
* Non-keyword token types. These are hard-wired into the "flex" lexer.
* They must be listed first so that their numeric codes do not depend on
* the set of keywords. PL/pgsql depends on this so that it can share the
* same lexer. If you add/change tokens here, fix PL/pgsql to match!
*
* TODO: Do we need DOT_DOT and COLON_EQUALS?
* DOT_DOT is unused in the core SQL grammar, and so will always provoke
* parse errors. It is needed by PL/pgsql.
*/
%token <str> IDENT FCONST SCONST Op
%token <ival> ICONST PARAM
%token TYPECAST DOT_DOT COLON_EQUALS
%%
statements: /* empty */
| statements ';' statement
;
statement:
{
$$ = &Node{}
}
%%