summaryrefslogtreecommitdiff
path: root/src/modules/ast/syntax-tree.scm
blob: 738b1155d7808df15bf2e4aea4d4b74bc37447b8 (plain)
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
(define-module (modules ast syntax-tree)
  #:use-module (srfi srfi-9)
  #:export (make-program
            program?
            program-function

            make-function
            function?
            function-id
            function-stmt

            make-stmt
            stmt?
            stmt-expr

            make-expr
            expr?
            expr-int

            make-id
            id?
            id-symbol))

(define-record-type <program>
  (make-program func)
  program?
  (func program-function))

(define-record-type <function>
  (make-function id stmt)
  function?
  (id function-id)
  (stmt function-stmt))

(define-record-type <stmt>
  (make-stmt expr)
  stmt?
  (expr stmt-expr))

(define-record-type <expr>
  (make-expr int)
  expr?
  (int expr-int))

(define-record-type <id>
  (make-id symbol)
  id?
  (symbol id-symbol))