summaryrefslogtreecommitdiff
path: root/src/modules/ast/syntax-tree.scm
diff options
context:
space:
mode:
authorbd <bdunahu@operationnull.com>2025-01-04 22:43:31 -0700
committerbd <bdunahu@operationnull.com>2025-01-04 22:43:31 -0700
commit0d69984338399a78a3ba6f3a2493f1ffb34964f8 (patch)
treea0ed32f2d0fb5a9ea8d47a4239425a4c87b26e07 /src/modules/ast/syntax-tree.scm
parent28116b7a9e77df0476f5dc15369637d508c1bfcb (diff)
Modify parser to handle unary operators
Diffstat (limited to 'src/modules/ast/syntax-tree.scm')
-rw-r--r--src/modules/ast/syntax-tree.scm26
1 files changed, 23 insertions, 3 deletions
diff --git a/src/modules/ast/syntax-tree.scm b/src/modules/ast/syntax-tree.scm
index 738b115..b7db8dd 100644
--- a/src/modules/ast/syntax-tree.scm
+++ b/src/modules/ast/syntax-tree.scm
@@ -15,7 +15,16 @@
make-expr
expr?
- expr-int
+ expr-type
+
+ make-unary
+ unary?
+ unary-operator
+ unary-expr
+
+ make-const
+ const?
+ const-int
make-id
id?
@@ -38,9 +47,20 @@
(expr stmt-expr))
(define-record-type <expr>
- (make-expr int)
+ (make-expr type)
expr?
- (int expr-int))
+ (type expr-type))
+
+(define-record-type <unary>
+ (make-unary op expr)
+ unary?
+ (op unary-operator)
+ (expr unary-expr))
+
+(define-record-type <const>
+ (make-const int)
+ const?
+ (int const-int))
(define-record-type <id>
(make-id symbol)