diff options
| author | bd <bdunahu@operationnull.com> | 2024-12-28 12:44:07 -0700 |
|---|---|---|
| committer | bd <bdunahu@operationnull.com> | 2024-12-28 12:47:56 -0700 |
| commit | babe9f9d0e84daec1015d7593a9d6c6d480662b8 (patch) | |
| tree | 1314d8803b4fa564e06c58444e3524e688c4f204 /src/modules/ast/syntax-tree.scm | |
| parent | 11ecac1d0686d5ed75b73eee0c860d7d67f6d6f0 (diff) | |
Assembly generation for trivial programs
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)) |
