From 1393ce3878e5d14214631fb83d58c819a7849b18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Thu, 7 Jul 2022 18:40:27 +0200 Subject: work. --- module/c/compiler.scm | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'module/c/compiler.scm') diff --git a/module/c/compiler.scm b/module/c/compiler.scm index 121e6c07..801c3752 100644 --- a/module/c/compiler.scm +++ b/module/c/compiler.scm @@ -2,14 +2,17 @@ :use-module ((c lex2) :select (lex)) :use-module ((c trigraph) :select (replace-trigraphs)) :use-module ((c line-fold) :select (fold-lines)) + :use-module (c cpp-environment object-like-macro) + :use-module ((c cpp-environment) + :select (make-environment + extend-environment + enter-file)) :use-module (hnh util) + ;; TODO importort + ;; handle-preprocessing-tokens + ;; load-and-tokenize-file :export (run-compiler)) -(define (comment->whitespace expr) - (match expr - (('comment _) '(whitespace " ")) - (other other))) - " #define __STDC__ 1 #define __STDC_HOSTED__ 1 @@ -36,17 +39,15 @@ body: `(preprocessing-token (string-literal ,(strftime "%b %_d %Y" now)))) (object-like-macro identifier: "__TIME__" - body: (preprocessing-token - (string-literal - ,(strftime "%H:%M:%S" now)))))) + body: `(preprocessing-token + (string-literal + ,(strftime "%H:%M:%S" now)))))) (define environment (-> (make-environment) (extend-environment default-macros))) -(define (read-file path) - (call-with-input-file path read-string)) ;;; 5.1.11.2 Translation phases -- cgit v1.2.3