aboutsummaryrefslogtreecommitdiff
path: root/source/lux/meta/ast.lux
blob: a601739a1e0f1f5a08149ebf7ccb479828b9f81f (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
##  Copyright (c) Eduardo Julian. All rights reserved.
##  This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
##  If a copy of the MPL was not distributed with this file,
##  You can obtain one at http://mozilla.org/MPL/2.0/.

(;import lux)

## [Types]
## (deftype (AST' w)
##   (| (#;BoolS Bool)
##      (#;IntS Int)
##      (#;RealS Real)
##      (#;CharS Char)
##      (#;TextS Text)
##      (#;SymbolS Text Text)
##      (#;TagS Text Text)
##      (#;FormS (List (w (AST' w))))
##      (#;TupleS (List (w (AST' w))))
##      (#;RecordS (List (, (w (AST' w)) (w (AST' w)))))))

## (deftype AST
##   (Meta Cursor (AST' (Meta Cursor))))

## [Utils]
(def _cursor Cursor ["" -1 -1])

## [Functions]
(do-template [<name> <type> <tag>]
  [(def #export (<name> x)
     (-> <type> AST)
     [_cursor (<tag> x)])]
  
  [bool$   Bool               #;BoolS]
  [int$    Int                #;IntS]
  [real$   Real               #;RealS]
  [char$   Char               #;CharS]
  [text$   Text               #;TextS]
  [symbol$ Ident              #;SymbolS]
  [tag$    Ident              #;TagS]
  [form$   (List AST)         #;FormS]
  [tuple$  (List AST)         #;TupleS]
  [record$ (List (, AST AST)) #;RecordS]
  )