aboutsummaryrefslogtreecommitdiff
path: root/module/c/cpp.scm
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2022-06-30 07:07:11 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2022-07-07 21:17:22 +0200
commit6f9af58e183e40a3c876230e41c3221155e4dcc2 (patch)
tree9b8395fe85fdf18dc380095a797d65ab6806624f /module/c/cpp.scm
parentFix escape sequences in chars and strings. (diff)
downloadcalp-6f9af58e183e40a3c876230e41c3221155e4dcc2.tar.gz
calp-6f9af58e183e40a3c876230e41c3221155e4dcc2.tar.xz
C parser minor cleanup.
Diffstat (limited to 'module/c/cpp.scm')
-rw-r--r--module/c/cpp.scm22
1 files changed, 19 insertions, 3 deletions
diff --git a/module/c/cpp.scm b/module/c/cpp.scm
index 86130167..861b8ee2 100644
--- a/module/c/cpp.scm
+++ b/module/c/cpp.scm
@@ -5,6 +5,7 @@
:use-module (ice-9 match)
:use-module (ice-9 regex)
:use-module ((rnrs io ports) :select (call-with-port))
+ :use-module ((rnrs bytevectors) :select (bytevector?))
:use-module (ice-9 format)
:use-module ((hnh util io) :select (read-lines))
:use-module (hnh util graph)
@@ -44,12 +45,27 @@
;; Direct values. Lisp also has quoted symbols in this group.
(define (immediate? x)
(or (number? x)
- (char? x)
- (string? x)))
+ (bytevector? x)))
+;; TODO replace this with something sensible
+;; like a correct list extracted from (c eval)
+;; and not thinging that types are variables
;; built in symbols. Should never be marked as dependencies
(define (primitive? x)
- (memv x (cons 'funcall binary-operators)))
+ (memv x `(
+ ;; language primitives
+ sizeof
+
+ ;; special forms introduced by parser
+ funcall ternary struct-type as-type
+
+ ;; unary operatons which aren't also binary operators
+ ++ -- ! ~
+ not compl dereference pointer
+ pre-increment pre-decrement
+ post-increment post-decrement
+ ,@binary-operators
+ )))