-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsyntax.rkt
37 lines (31 loc) · 1.37 KB
/
syntax.rkt
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
#lang rosette
(require "table.rkt")
(provide (all-defined-out))
;;; query structure
; select-args : a list of values
; from-queries : a list of tables/subqueries
; where-filter : a filter
(struct query-select (select-args from-query where-filter) #:transparent)
(struct query-select-distinct (select-args from-query where-filter) #:transparent)
(struct query-join (query1 query2) #:transparent)
(struct query-named (table-ref) #:transparent)
(struct query-rename (query table-name) #:transparent)
(struct query-rename-full (query table-name column-names) #:transparent)
(struct query-left-outer-join (query1 query2 pred) #:transparent)
(struct query-union-all (query1 query2))
(struct query-aggr-general (query where-filter gb-fields select-args having-filter) #:transparent)
;;; values
(struct val-const (val) #:transparent)
(struct val-column-ref (column-name) #:transparent)
(struct val-aggr-subq (agg-func query) #:transparent)
(struct val-bexpr (binop v1 v2) #:transparent)
(struct val-uexpr (op val) #:transparent)
;;; filters
(struct filter-binop (op val1 val2) #:transparent)
(struct filter-conj (f1 f2) #:transparent)
(struct filter-disj (f1 f2) #:transparent)
(struct filter-not (f1) #:transparent)
(struct filter-exists (query) #:transparent)
(struct filter-true () #:transparent)
(struct filter-false () #:transparent)
(struct filter-nary-op (f args) #:transparent) ; n-ary-operator