From 0d69984338399a78a3ba6f3a2493f1ffb34964f8 Mon Sep 17 00:00:00 2001 From: bd Date: Sat, 4 Jan 2025 22:43:31 -0700 Subject: Modify parser to handle unary operators --- src/modules/ast/syntax-tree.scm | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'src/modules/ast/syntax-tree.scm') 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 - (make-expr int) + (make-expr type) expr? - (int expr-int)) + (type expr-type)) + +(define-record-type + (make-unary op expr) + unary? + (op unary-operator) + (expr unary-expr)) + +(define-record-type + (make-const int) + const? + (int const-int)) (define-record-type (make-id symbol) -- cgit v1.2.3