diff options
Diffstat (limited to 'src/modules/ast/syntax-tree.scm')
-rw-r--r-- | src/modules/ast/syntax-tree.scm | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/modules/ast/syntax-tree.scm b/src/modules/ast/syntax-tree.scm new file mode 100644 index 0000000..738b115 --- /dev/null +++ b/src/modules/ast/syntax-tree.scm @@ -0,0 +1,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)) |