You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
 
 

18 lines
505 B

%token <string> ID
%token NL
%token TABLE "table"
%token RELAT "relat"
%token DCOLON ":"
%token EOF
%start <Ast.ent list> prog
%%
prog: NL?; es = list(x = ent; NL { x }); EOF { es };
rtablename: x = ID { Ast.parse_rtabnam x };
ent:
| TABLE; t = ID; pks = list(ID); DCOLON; attrs = list(ID) { Ast.Table (t, { tprimkeys = pks; tattrs = attrs }) }
| RELAT; r = ID; rts = list(rtablename); DCOLON; attrs = list(ID) { Ast.Relation { rname = r; relates = rts; rattrs = attrs } }
;