aboutsummaryrefslogtreecommitdiff
path: root/module/c/compiler.scm
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2022-07-07 18:40:27 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2022-07-07 21:31:32 +0200
commit1393ce3878e5d14214631fb83d58c819a7849b18 (patch)
treed1e34b2b459ea9c1702ac72f6e66f0b05ce45223 /module/c/compiler.scm
parentChange makefile to explicit list of files. (diff)
downloadcalp-1393ce3878e5d14214631fb83d58c819a7849b18.tar.gz
calp-1393ce3878e5d14214631fb83d58c819a7849b18.tar.xz
work.
Diffstat (limited to 'module/c/compiler.scm')
-rw-r--r--module/c/compiler.scm21
1 files changed, 11 insertions, 10 deletions
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