-
Notifications
You must be signed in to change notification settings - Fork 0
/
syntax-defs.lisp
46 lines (36 loc) · 1.18 KB
/
syntax-defs.lisp
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
(defclass expr ()
()
(:documentation "Expression"))
(defclass symbol-expr (expr)
((symbol :initarg :symbol :reader expr-symbol)))
(defclass var-expr (symbol-expr)
()
(:documentation "Variable occurance"))
(defclass cons-expr (symbol-expr)
()
(:documentation "Constructor"))
(defclass apply-expr (expr)
((fun :initarg :fun :reader expr-fun)
(arg :initarg :arg :reader expr-arg))
(:documentation "Function application"))
(defclass let-expr (expr)
((bindings :initarg :bindings :reader expr-bindings)
(body :initarg :body :reader expr-body))
(:documentation "Let"))
(defclass lambda-expr (expr)
((formals :initarg :formals :reader expr-formals)
(body :initarg :body :reader expr-body))
(:documentation "Lambda abstraction"))
(defclass pattern ()
()
(:documentation "Pattern"))
(defclass wildcard-pattern (pattern)
()
(:documentation "Wildcard pattern"))
(defclass var-pattern (pattern)
((symbol :initarg :symbol :reader pattern-symbol))
(:documentation "Variable binder"))
(defclass cons-pattern (pattern)
((cons :initarg :cons :reader pattern-cons)
(args :initarg :args :initform nil :reader pattern-args))
(:documentation "Constructor pattern"))