make each compiler module one file, built once
A module was a body plus a (module ...) wrapper naming its exports, and the wrapper came in up to three copies: the root's, a test one that exported everything, and sextest's, each recompiling the same body. csc -module makes a file a module by itself, with export forms in its body, so the wrappers are gone. tests/ and tools/sextest/ link what the root built, finding it on the repository path; the tests see what a module exports, and the names only they need are exported as such.
This commit is contained in:
43
Makefile
43
Makefile
@@ -65,42 +65,29 @@ sexc: $(OBJ) main.scm
|
|||||||
|
|
||||||
#------------------------------------------------------------------
|
#------------------------------------------------------------------
|
||||||
|
|
||||||
utils.o: utils.module.scm utils.scm
|
# A module is one file that declares its own exports, made a module by
|
||||||
$(CHICKEN_C) $(CSC_FLAGS) $(MODULE_FLAGS) utils.module.scm -o utils.o -unit utils
|
# -module
|
||||||
|
|
||||||
types.o: types.module.scm types.scm
|
%.o: %.scm
|
||||||
$(CHICKEN_C) $(CSC_FLAGS) $(MODULE_FLAGS) types.module.scm -o types.o -unit types
|
$(CHICKEN_C) $(CSC_FLAGS) $(MODULE_FLAGS) $< -module $* -o $@ -unit $*
|
||||||
|
|
||||||
infer.o: infer.module.scm infer.scm types.o utils.o
|
infer.o: types.o utils.o
|
||||||
$(CHICKEN_C) $(CSC_FLAGS) $(MODULE_FLAGS) infer.module.scm -o infer.o -unit infer -link types,utils
|
reader.o: utils.o
|
||||||
|
sex-modules.o: reader.o types.o utils.o
|
||||||
sex-macros.o: sex-macros.module.scm sex-macros.scm
|
semen.o: infer.o sex-macros.o sex-modules.o types.o utils.o
|
||||||
$(CHICKEN_C) $(CSC_FLAGS) $(MODULE_FLAGS) sex-macros.module.scm -o sex-macros.o -unit sex-macros
|
fmt-c-writer.o: sex-fmt-c.o types.o utils.o
|
||||||
|
sexc.o: fmt-c-writer.o infer.o reader.o semen.o sex-macros.o sex-modules.o types.o utils.o
|
||||||
reader.o: reader.module.scm reader.scm utils.o
|
|
||||||
$(CHICKEN_C) $(CSC_FLAGS) $(MODULE_FLAGS) reader.module.scm -o reader.o -unit reader -link utils
|
|
||||||
|
|
||||||
sex-modules.o: sex-modules.module.scm sex-modules.scm reader.o types.o utils.o
|
|
||||||
$(CHICKEN_C) $(CSC_FLAGS) $(MODULE_FLAGS) sex-modules.module.scm -o sex-modules.o -unit sex-modules -link reader,types,utils
|
|
||||||
|
|
||||||
semen.o: semen.module.scm semen.scm infer.o sex-macros.o sex-modules.o types.o utils.o
|
|
||||||
$(CHICKEN_C) $(CSC_FLAGS) $(MODULE_FLAGS) semen.module.scm -o semen.o -unit semen -link sex-macros,sex-modules,infer,types,utils
|
|
||||||
|
|
||||||
|
# Vendored, and a (module ...) form of its own
|
||||||
sex-fmt-c.o: sex-fmt-c.scm
|
sex-fmt-c.o: sex-fmt-c.scm
|
||||||
$(CHICKEN_C) $(CSC_FLAGS) $(MODULE_FLAGS) sex-fmt-c.scm -o sex-fmt-c.o -unit sex-fmt-c
|
$(CHICKEN_C) $(CSC_FLAGS) $(MODULE_FLAGS) $< -o $@ -unit sex-fmt-c
|
||||||
|
|
||||||
fmt-c-writer.o: fmt-c-writer.module.scm fmt-c-writer.scm sex-fmt-c.o types.o utils.o
|
# Unit testing. Both link the modules built here
|
||||||
$(CHICKEN_C) $(CSC_FLAGS) $(MODULE_FLAGS) fmt-c-writer.module.scm -o fmt-c-writer.o -unit fmt-c-writer -link sex-fmt-c,types,utils
|
sex-tests: $(OBJ)
|
||||||
|
|
||||||
sexc.o: sexc.module.scm infer.o types.o sexc.scm fmt-c-writer.o sex-macros.o sex-modules.o reader.o semen.o utils.o
|
|
||||||
$(CHICKEN_C) $(CSC_FLAGS) $(MODULE_FLAGS) sexc.module.scm -o sexc.o -unit sexc -link fmt-c-writer,sex-macros,sex-modules,reader,semen,infer,types,utils
|
|
||||||
|
|
||||||
# Unit testing
|
|
||||||
sex-tests:
|
|
||||||
$(MAKE) -C ./tests sex-tests
|
$(MAKE) -C ./tests sex-tests
|
||||||
cp ./tests/sex-tests ./
|
cp ./tests/sex-tests ./
|
||||||
|
|
||||||
sextest:
|
sextest: reader.o utils.o
|
||||||
$(MAKE) -C ./tools/sextest sextest
|
$(MAKE) -C ./tools/sextest sextest
|
||||||
cp ./tools/sextest/sextest .
|
cp ./tools/sextest/sextest .
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
(module fmt-c-writer (emit-c
|
|
||||||
sex-line-directives)
|
|
||||||
"fmt-c-writer.scm")
|
|
||||||
@@ -4,6 +4,7 @@
|
|||||||
scheme
|
scheme
|
||||||
(scheme base) ; make-parameter
|
(scheme base) ; make-parameter
|
||||||
(chicken base)
|
(chicken base)
|
||||||
|
(chicken module)
|
||||||
(chicken string)
|
(chicken string)
|
||||||
(chicken syntax)
|
(chicken syntax)
|
||||||
brev-separate ; fn, flatten
|
brev-separate ; fn, flatten
|
||||||
@@ -16,6 +17,14 @@
|
|||||||
types ; array-bound?, named-arg?
|
types ; array-bound?, named-arg?
|
||||||
utils)
|
utils)
|
||||||
|
|
||||||
|
(export
|
||||||
|
emit-c
|
||||||
|
sex-line-directives
|
||||||
|
|
||||||
|
;; for the tests
|
||||||
|
atom-to-fmt-c unkebabify type-convert-to-c
|
||||||
|
process-toplevel-form walk-expr walk-type walk-var walk-fn-def walk-struct)
|
||||||
|
|
||||||
;;; egg `tree' not ported to CHICKEN 6 yet
|
;;; egg `tree' not ported to CHICKEN 6 yet
|
||||||
(define (tree-map f tree)
|
(define (tree-map f tree)
|
||||||
(cond ((null? tree) (list))
|
(cond ((null? tree) (list))
|
||||||
|
|||||||
@@ -1,45 +0,0 @@
|
|||||||
(module infer
|
|
||||||
(;; The IR
|
|
||||||
tvar?
|
|
||||||
tvar-id
|
|
||||||
tvar-classes
|
|
||||||
tvar-rigid?
|
|
||||||
fresh-tvar
|
|
||||||
fresh-rigid-tvar
|
|
||||||
|
|
||||||
prim-type? prim-name prim-quals make-prim
|
|
||||||
ptr-type? ptr-target ptr-quals make-ptr
|
|
||||||
array-type? array-elt array-size make-array-type
|
|
||||||
fn-type? fn-ret fn-args fn-variadic? make-fn-type
|
|
||||||
agg-type? agg-kind agg-name agg-spelling agg-quals make-agg
|
|
||||||
alias-type? alias-name alias-expansion alias-quals make-alias
|
|
||||||
unknown-type? the-unknown-type
|
|
||||||
|
|
||||||
resolve
|
|
||||||
underlying
|
|
||||||
c-primitive?
|
|
||||||
type-quals
|
|
||||||
free-tvars
|
|
||||||
decay
|
|
||||||
|
|
||||||
;; The boundary
|
|
||||||
parse-type
|
|
||||||
unparse-type
|
|
||||||
|
|
||||||
;; Constraints
|
|
||||||
register-class!
|
|
||||||
add-instance!
|
|
||||||
entails?
|
|
||||||
default-tvar!
|
|
||||||
default-type-variables!
|
|
||||||
|
|
||||||
;; Unification
|
|
||||||
unify
|
|
||||||
|
|
||||||
;; Type schemes
|
|
||||||
scheme? scheme-vars scheme-constraints scheme-type
|
|
||||||
make-scheme
|
|
||||||
generalize
|
|
||||||
instantiate
|
|
||||||
substitute)
|
|
||||||
"infer.scm")
|
|
||||||
46
infer.scm
46
infer.scm
@@ -25,12 +25,58 @@
|
|||||||
scheme
|
scheme
|
||||||
(scheme base)
|
(scheme base)
|
||||||
(chicken base)
|
(chicken base)
|
||||||
|
(chicken module)
|
||||||
matchable
|
matchable
|
||||||
srfi-1
|
srfi-1
|
||||||
srfi-69
|
srfi-69
|
||||||
types
|
types
|
||||||
utils)
|
utils)
|
||||||
|
|
||||||
|
(export
|
||||||
|
;; The IR
|
||||||
|
tvar?
|
||||||
|
tvar-id
|
||||||
|
tvar-classes
|
||||||
|
tvar-rigid?
|
||||||
|
fresh-tvar
|
||||||
|
fresh-rigid-tvar
|
||||||
|
|
||||||
|
prim-type? prim-name prim-quals make-prim
|
||||||
|
ptr-type? ptr-target ptr-quals make-ptr
|
||||||
|
array-type? array-elt array-size make-array-type
|
||||||
|
fn-type? fn-ret fn-args fn-variadic? make-fn-type
|
||||||
|
agg-type? agg-kind agg-name agg-spelling agg-quals make-agg
|
||||||
|
alias-type? alias-name alias-expansion alias-quals make-alias
|
||||||
|
unknown-type? the-unknown-type
|
||||||
|
|
||||||
|
resolve
|
||||||
|
underlying
|
||||||
|
c-primitive?
|
||||||
|
type-quals
|
||||||
|
free-tvars
|
||||||
|
decay
|
||||||
|
|
||||||
|
;; The boundary
|
||||||
|
parse-type
|
||||||
|
unparse-type
|
||||||
|
|
||||||
|
;; Constraints
|
||||||
|
register-class!
|
||||||
|
add-instance!
|
||||||
|
entails?
|
||||||
|
default-tvar!
|
||||||
|
default-type-variables!
|
||||||
|
|
||||||
|
;; Unification
|
||||||
|
unify
|
||||||
|
|
||||||
|
;; Type schemes
|
||||||
|
scheme? scheme-vars scheme-constraints scheme-type
|
||||||
|
make-scheme
|
||||||
|
generalize
|
||||||
|
instantiate
|
||||||
|
substitute)
|
||||||
|
|
||||||
;;; ---------------------------------------------------------------
|
;;; ---------------------------------------------------------------
|
||||||
;;; The IR
|
;;; The IR
|
||||||
;;; ---------------------------------------------------------------
|
;;; ---------------------------------------------------------------
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
(module reader (read-from-file
|
|
||||||
read-raw-forms
|
|
||||||
|
|
||||||
current-features
|
|
||||||
platform-features)
|
|
||||||
"reader.scm")
|
|
||||||
11
reader.scm
11
reader.scm
@@ -16,11 +16,22 @@
|
|||||||
scheme
|
scheme
|
||||||
(scheme base) ; make-parameter
|
(scheme base) ; make-parameter
|
||||||
(chicken base)
|
(chicken base)
|
||||||
|
(chicken module)
|
||||||
(chicken pathname)
|
(chicken pathname)
|
||||||
(chicken platform) ; software-version, machine-type
|
(chicken platform) ; software-version, machine-type
|
||||||
(only srfi-1 every any) ; srfi-1 also has an append-reverse
|
(only srfi-1 every any) ; srfi-1 also has an append-reverse
|
||||||
utils)
|
utils)
|
||||||
|
|
||||||
|
(export
|
||||||
|
read-from-file
|
||||||
|
read-raw-forms
|
||||||
|
|
||||||
|
current-features
|
||||||
|
platform-features
|
||||||
|
|
||||||
|
;; for the tests
|
||||||
|
parse-all)
|
||||||
|
|
||||||
;;; Sentinels for structural tokens
|
;;; Sentinels for structural tokens
|
||||||
(define close-paren (list '%close-paren))
|
(define close-paren (list '%close-paren))
|
||||||
(define close-bracket (list '%close-bracket))
|
(define close-bracket (list '%close-bracket))
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
(module semen ()
|
|
||||||
"semen.scm")
|
|
||||||
@@ -19,7 +19,11 @@
|
|||||||
)
|
)
|
||||||
|
|
||||||
(export/rename (process semen-process))
|
(export/rename (process semen-process))
|
||||||
(export closure-env-declaration)
|
(export closure-env-declaration
|
||||||
|
;; for the tests
|
||||||
|
sex-fn? sex-fn-public? sex-fn-name sex-fn-arglist
|
||||||
|
sex-fn-return-type sex-fn-prototype sex-fn-body
|
||||||
|
walk-form macro-expand)
|
||||||
|
|
||||||
;;; for lambda extraction, docstring processing, macro expansion,
|
;;; for lambda extraction, docstring processing, macro expansion,
|
||||||
;;; injection of module headers, i.e. all things that rearrange code
|
;;; injection of module headers, i.e. all things that rearrange code
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
(module sex-macros
|
|
||||||
(register-macro
|
|
||||||
cat
|
|
||||||
comment
|
|
||||||
get-macro
|
|
||||||
macro?
|
|
||||||
apply-macro
|
|
||||||
defmacro)
|
|
||||||
"sex-macros.scm")
|
|
||||||
@@ -2,9 +2,19 @@
|
|||||||
scheme
|
scheme
|
||||||
(only fmt fmt)
|
(only fmt fmt)
|
||||||
(chicken base)
|
(chicken base)
|
||||||
|
(chicken module)
|
||||||
(chicken plist)
|
(chicken plist)
|
||||||
(chicken string))
|
(chicken string))
|
||||||
|
|
||||||
|
(export
|
||||||
|
register-macro
|
||||||
|
cat
|
||||||
|
comment
|
||||||
|
get-macro
|
||||||
|
macro?
|
||||||
|
apply-macro
|
||||||
|
defmacro)
|
||||||
|
|
||||||
(define (cat-syms s-1 s-2)
|
(define (cat-syms s-1 s-2)
|
||||||
(fmt #f s-1 s-2))
|
(fmt #f s-1 s-2))
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
(module sex-modules
|
|
||||||
(get-modules-public-forms
|
|
||||||
load-persistent-module-paths
|
|
||||||
check-public-interface
|
|
||||||
module-dependencies
|
|
||||||
read-public-interface)
|
|
||||||
"sex-modules.scm")
|
|
||||||
@@ -4,6 +4,7 @@
|
|||||||
(chicken base)
|
(chicken base)
|
||||||
(chicken file)
|
(chicken file)
|
||||||
(chicken load)
|
(chicken load)
|
||||||
|
(chicken module)
|
||||||
(chicken pathname)
|
(chicken pathname)
|
||||||
(chicken process-context)
|
(chicken process-context)
|
||||||
(chicken string)
|
(chicken string)
|
||||||
@@ -14,6 +15,16 @@
|
|||||||
types
|
types
|
||||||
utils)
|
utils)
|
||||||
|
|
||||||
|
(export
|
||||||
|
get-modules-public-forms
|
||||||
|
load-persistent-module-paths
|
||||||
|
check-public-interface
|
||||||
|
module-dependencies
|
||||||
|
read-public-interface
|
||||||
|
|
||||||
|
;; for the tests
|
||||||
|
get-module-paths)
|
||||||
|
|
||||||
(define +persistent-module-paths+ (list))
|
(define +persistent-module-paths+ (list))
|
||||||
|
|
||||||
;;; for guarding against multiple imports (sort of mandatory #pragma
|
;;; for guarding against multiple imports (sort of mandatory #pragma
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
(module sexc (main) "sexc.scm")
|
|
||||||
8
sexc.scm
8
sexc.scm
@@ -4,6 +4,7 @@
|
|||||||
(chicken base)
|
(chicken base)
|
||||||
(chicken condition) ; handle-exceptions
|
(chicken condition) ; handle-exceptions
|
||||||
(chicken file)
|
(chicken file)
|
||||||
|
(chicken module)
|
||||||
(chicken plist)
|
(chicken plist)
|
||||||
(chicken pretty-print)
|
(chicken pretty-print)
|
||||||
(chicken process)
|
(chicken process)
|
||||||
@@ -20,6 +21,13 @@
|
|||||||
srfi-1 ; list routines
|
srfi-1 ; list routines
|
||||||
utils)
|
utils)
|
||||||
|
|
||||||
|
(export
|
||||||
|
main
|
||||||
|
|
||||||
|
;; for the tests
|
||||||
|
args-before-separator args-after-separator
|
||||||
|
dependency-rule spell-stdout-output)
|
||||||
|
|
||||||
;;; Main function facilities
|
;;; Main function facilities
|
||||||
|
|
||||||
(define opts-grammar
|
(define opts-grammar
|
||||||
|
|||||||
@@ -1,53 +1,21 @@
|
|||||||
CHICKEN_C = csc
|
CHICKEN_C = csc
|
||||||
|
|
||||||
CSC_FLAGS += -K prefix -static
|
CSC_FLAGS += -K prefix -static
|
||||||
MODULE_FLAGS = -emit-all-import-libraries -module-registration -c
|
|
||||||
|
# The compiler's modules are built once, in the root; their import
|
||||||
|
# libraries and objects are found there through the repository path
|
||||||
|
ROOT = ..
|
||||||
|
export CHICKEN_REPOSITORY_PATH := $(abspath $(ROOT)):$(or $(CHICKEN_REPOSITORY_PATH),$(shell chicken-install -repository))
|
||||||
|
|
||||||
MODULES = utils types infer sex-macros reader sex-modules semen sex-fmt-c fmt-c-writer sexc
|
MODULES = utils types infer sex-macros reader sex-modules semen sex-fmt-c fmt-c-writer sexc
|
||||||
SEX_OBJ = $(MODULES:%=%.o)
|
|
||||||
|
|
||||||
TESTS = basic semen reader fmt-c-writer utils line-directives codegen encapsulation args module-path types infer
|
TESTS = basic semen reader fmt-c-writer utils line-directives codegen encapsulation args module-path types infer
|
||||||
TEST_SRCS = $(TESTS:%=%.scm)
|
TEST_SRCS = $(TESTS:%=%.scm)
|
||||||
|
|
||||||
sex-tests: run.scm $(TEST_SRCS) $(SEX_OBJ)
|
sex-tests: run.scm $(TEST_SRCS) $(MODULES:%=$(ROOT)/%.o)
|
||||||
$(CHICKEN_C) $(CSC_FLAGS) run.scm -o sex-tests -link sexc
|
$(CHICKEN_C) $(CSC_FLAGS) run.scm -o sex-tests -link sexc
|
||||||
|
|
||||||
#------------------------------------------------------------------
|
|
||||||
|
|
||||||
utils.o: utils.module.scm ../utils.scm
|
|
||||||
$(CHICKEN_C) $(CSC_FLAGS) $(MODULE_FLAGS) utils.module.scm -o utils.o -unit utils
|
|
||||||
|
|
||||||
types.o: types.module.scm ../types.scm
|
|
||||||
$(CHICKEN_C) $(CSC_FLAGS) $(MODULE_FLAGS) types.module.scm -o types.o -unit types
|
|
||||||
|
|
||||||
infer.o: infer.module.scm ../infer.scm types.o utils.o
|
|
||||||
$(CHICKEN_C) $(CSC_FLAGS) $(MODULE_FLAGS) infer.module.scm -o infer.o -unit infer -link types,utils
|
|
||||||
|
|
||||||
sex-macros.o: sex-macros.module.scm ../sex-macros.scm
|
|
||||||
$(CHICKEN_C) $(CSC_FLAGS) $(MODULE_FLAGS) sex-macros.module.scm -o sex-macros.o -unit sex-macros
|
|
||||||
|
|
||||||
reader.o: reader.module.scm ../reader.scm utils.o
|
|
||||||
$(CHICKEN_C) $(CSC_FLAGS) $(MODULE_FLAGS) reader.module.scm -o reader.o -unit reader -link utils
|
|
||||||
|
|
||||||
sex-modules.o: sex-modules.module.scm ../sex-modules.scm reader.o types.o utils.o
|
|
||||||
$(CHICKEN_C) $(CSC_FLAGS) $(MODULE_FLAGS) sex-modules.module.scm -o sex-modules.o -unit sex-modules -link reader,types,utils
|
|
||||||
|
|
||||||
semen.o: semen.module.scm ../semen.scm infer.o sex-macros.o sex-modules.o types.o utils.o
|
|
||||||
$(CHICKEN_C) $(CSC_FLAGS) $(MODULE_FLAGS) semen.module.scm -o semen.o -unit semen -link sex-macros,sex-modules,infer,types,utils
|
|
||||||
|
|
||||||
sex-fmt-c.o: ../sex-fmt-c.scm
|
|
||||||
$(CHICKEN_C) $(CSC_FLAGS) $(MODULE_FLAGS) ../sex-fmt-c.scm -o sex-fmt-c.o -unit sex-fmt-c
|
|
||||||
|
|
||||||
fmt-c-writer.o: fmt-c-writer.module.scm ../fmt-c-writer.scm sex-fmt-c.o types.o utils.o
|
|
||||||
$(CHICKEN_C) $(CSC_FLAGS) $(MODULE_FLAGS) fmt-c-writer.module.scm -o fmt-c-writer.o -unit fmt-c-writer -link sex-fmt-c,types,utils
|
|
||||||
|
|
||||||
sexc.o: sexc.module.scm infer.o types.o ../sexc.scm fmt-c-writer.o sex-macros.o sex-modules.o reader.o semen.o utils.o
|
|
||||||
$(CHICKEN_C) $(CSC_FLAGS) $(MODULE_FLAGS) sexc.module.scm -o sexc.o -unit sexc -link fmt-c-writer,sex-macros,sex-modules,reader,semen,infer,types,utils
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f $(SEX_OBJ)
|
|
||||||
rm -f *.import.scm
|
|
||||||
rm -f *.link
|
|
||||||
rm -f sex-tests
|
rm -f sex-tests
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
(module fmt-c-writer
|
|
||||||
*
|
|
||||||
"../fmt-c-writer.scm")
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
(module infer
|
|
||||||
(;; The IR
|
|
||||||
tvar?
|
|
||||||
tvar-id
|
|
||||||
tvar-classes
|
|
||||||
tvar-rigid?
|
|
||||||
fresh-tvar
|
|
||||||
fresh-rigid-tvar
|
|
||||||
|
|
||||||
prim-type? prim-name prim-quals make-prim
|
|
||||||
ptr-type? ptr-target ptr-quals make-ptr
|
|
||||||
array-type? array-elt array-size make-array-type
|
|
||||||
fn-type? fn-ret fn-args fn-variadic? make-fn-type
|
|
||||||
agg-type? agg-kind agg-name agg-spelling agg-quals make-agg
|
|
||||||
alias-type? alias-name alias-expansion alias-quals make-alias
|
|
||||||
unknown-type? the-unknown-type
|
|
||||||
|
|
||||||
resolve
|
|
||||||
underlying
|
|
||||||
c-primitive?
|
|
||||||
type-quals
|
|
||||||
free-tvars
|
|
||||||
decay
|
|
||||||
|
|
||||||
;; The boundary
|
|
||||||
parse-type
|
|
||||||
unparse-type
|
|
||||||
|
|
||||||
;; Constraints
|
|
||||||
register-class!
|
|
||||||
add-instance!
|
|
||||||
entails?
|
|
||||||
default-tvar!
|
|
||||||
default-type-variables!
|
|
||||||
|
|
||||||
;; Unification
|
|
||||||
unify
|
|
||||||
|
|
||||||
;; Type schemes
|
|
||||||
scheme? scheme-vars scheme-constraints scheme-type
|
|
||||||
make-scheme
|
|
||||||
generalize
|
|
||||||
instantiate
|
|
||||||
substitute)
|
|
||||||
"../infer.scm")
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
(module reader
|
|
||||||
*
|
|
||||||
"../reader.scm")
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
(module semen *
|
|
||||||
"../semen.scm")
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
(module sex-macros
|
|
||||||
*
|
|
||||||
"../sex-macros.scm")
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
(module sex-modules
|
|
||||||
*
|
|
||||||
"../sex-modules.scm")
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
(module sexc
|
|
||||||
*
|
|
||||||
"../sexc.scm")
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
(module types
|
|
||||||
(add-struct
|
|
||||||
add-union
|
|
||||||
add-enum
|
|
||||||
add-typedef
|
|
||||||
add-define
|
|
||||||
|
|
||||||
type-match
|
|
||||||
type-pattern-matches?
|
|
||||||
map-fields
|
|
||||||
|
|
||||||
add-sum!
|
|
||||||
get-sum
|
|
||||||
add-constructor!
|
|
||||||
get-constructor
|
|
||||||
variant-fields
|
|
||||||
reset-declarations!
|
|
||||||
|
|
||||||
add-spec!
|
|
||||||
get-spec
|
|
||||||
spec-parameter
|
|
||||||
spec-methods
|
|
||||||
add-realization!
|
|
||||||
realizes?
|
|
||||||
normalize-fields
|
|
||||||
|
|
||||||
add-method!
|
|
||||||
get-method
|
|
||||||
qualify-op
|
|
||||||
ops-key
|
|
||||||
|
|
||||||
add-name-type!
|
|
||||||
get-name-type
|
|
||||||
type-of
|
|
||||||
current-type-of
|
|
||||||
get-return-type
|
|
||||||
|
|
||||||
get-type-info
|
|
||||||
get-tag-info
|
|
||||||
get-fields
|
|
||||||
get-underlying-type
|
|
||||||
|
|
||||||
type-head?
|
|
||||||
named-arg?
|
|
||||||
named-arg-type
|
|
||||||
arglist-types
|
|
||||||
strip-pub
|
|
||||||
array-bound?
|
|
||||||
array-element-type)
|
|
||||||
"../types.scm")
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
(module utils
|
|
||||||
*
|
|
||||||
"../utils.scm")
|
|
||||||
@@ -1,23 +1,16 @@
|
|||||||
CHICKEN_C = csc
|
CHICKEN_C = csc
|
||||||
CSC_FLAGS += -K prefix -static
|
CSC_FLAGS += -K prefix -static
|
||||||
MODULE_FLAGS = -emit-all-import-libraries -module-registration -c
|
|
||||||
|
|
||||||
ROOT = ../..
|
|
||||||
|
|
||||||
# sextest reuses sexc's reader (and its utils dependency) instead of
|
# sextest reuses sexc's reader (and its utils dependency) instead of
|
||||||
# duplicating the S-expression reader. The module wrappers here include
|
# duplicating the S-expression reader: both are linked from the root,
|
||||||
# the shared sources from the project root.
|
# found there through the repository path
|
||||||
|
ROOT = ../..
|
||||||
|
export CHICKEN_REPOSITORY_PATH := $(abspath $(ROOT)):$(or $(CHICKEN_REPOSITORY_PATH),$(shell chicken-install -repository))
|
||||||
|
|
||||||
sextest: sextest.scm reader.o utils.o
|
sextest: sextest.scm $(ROOT)/reader.o $(ROOT)/utils.o
|
||||||
$(CHICKEN_C) $(CSC_FLAGS) sextest.scm -o sextest -link reader,utils
|
$(CHICKEN_C) $(CSC_FLAGS) sextest.scm -o sextest -link reader,utils
|
||||||
|
|
||||||
utils.o: utils.module.scm $(ROOT)/utils.scm
|
|
||||||
$(CHICKEN_C) $(CSC_FLAGS) $(MODULE_FLAGS) utils.module.scm -o utils.o -unit utils
|
|
||||||
|
|
||||||
reader.o: reader.module.scm $(ROOT)/reader.scm utils.o
|
|
||||||
$(CHICKEN_C) $(CSC_FLAGS) $(MODULE_FLAGS) reader.module.scm -o reader.o -unit reader -link utils
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.o *.import.scm *.link sextest
|
rm -f sextest
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
(module reader (read-from-file
|
|
||||||
read-raw-forms
|
|
||||||
|
|
||||||
current-features
|
|
||||||
platform-features)
|
|
||||||
"../../reader.scm")
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
(module utils
|
|
||||||
(get-env-var
|
|
||||||
set-working-directory
|
|
||||||
to-absolute-pathname
|
|
||||||
comment-form?
|
|
||||||
strip-header-comments
|
|
||||||
list-split
|
|
||||||
list-join
|
|
||||||
recons
|
|
||||||
current-source-file
|
|
||||||
set-form-source!
|
|
||||||
form-source
|
|
||||||
form-file
|
|
||||||
form-line
|
|
||||||
copy-form-source!
|
|
||||||
stamp-form-source!
|
|
||||||
form-location
|
|
||||||
sex-error
|
|
||||||
with-directory
|
|
||||||
)
|
|
||||||
"../../utils.scm")
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
(module types
|
|
||||||
(add-struct
|
|
||||||
add-union
|
|
||||||
add-enum
|
|
||||||
add-typedef
|
|
||||||
add-define
|
|
||||||
|
|
||||||
type-match
|
|
||||||
type-pattern-matches?
|
|
||||||
map-fields
|
|
||||||
|
|
||||||
add-sum!
|
|
||||||
get-sum
|
|
||||||
add-constructor!
|
|
||||||
get-constructor
|
|
||||||
variant-fields
|
|
||||||
reset-declarations!
|
|
||||||
|
|
||||||
add-spec!
|
|
||||||
get-spec
|
|
||||||
spec-parameter
|
|
||||||
spec-methods
|
|
||||||
add-realization!
|
|
||||||
realizes?
|
|
||||||
normalize-fields
|
|
||||||
|
|
||||||
add-method!
|
|
||||||
get-method
|
|
||||||
qualify-op
|
|
||||||
ops-key
|
|
||||||
|
|
||||||
add-name-type!
|
|
||||||
get-name-type
|
|
||||||
type-of
|
|
||||||
current-type-of
|
|
||||||
get-return-type
|
|
||||||
|
|
||||||
get-type-info
|
|
||||||
get-tag-info
|
|
||||||
get-fields
|
|
||||||
get-underlying-type
|
|
||||||
|
|
||||||
type-head?
|
|
||||||
named-arg?
|
|
||||||
named-arg-type
|
|
||||||
arglist-types
|
|
||||||
strip-pub
|
|
||||||
array-bound?
|
|
||||||
array-element-type)
|
|
||||||
"types.scm")
|
|
||||||
51
types.scm
51
types.scm
@@ -12,9 +12,60 @@
|
|||||||
scheme
|
scheme
|
||||||
(scheme base)
|
(scheme base)
|
||||||
(chicken base)
|
(chicken base)
|
||||||
|
(chicken module)
|
||||||
srfi-1
|
srfi-1
|
||||||
srfi-69)
|
srfi-69)
|
||||||
|
|
||||||
|
(export
|
||||||
|
add-struct
|
||||||
|
add-union
|
||||||
|
add-enum
|
||||||
|
add-typedef
|
||||||
|
add-define
|
||||||
|
|
||||||
|
type-match
|
||||||
|
type-pattern-matches?
|
||||||
|
map-fields
|
||||||
|
|
||||||
|
add-sum!
|
||||||
|
get-sum
|
||||||
|
add-constructor!
|
||||||
|
get-constructor
|
||||||
|
variant-fields
|
||||||
|
reset-declarations!
|
||||||
|
|
||||||
|
add-spec!
|
||||||
|
get-spec
|
||||||
|
spec-parameter
|
||||||
|
spec-methods
|
||||||
|
add-realization!
|
||||||
|
realizes?
|
||||||
|
normalize-fields
|
||||||
|
|
||||||
|
add-method!
|
||||||
|
get-method
|
||||||
|
qualify-op
|
||||||
|
ops-key
|
||||||
|
|
||||||
|
add-name-type!
|
||||||
|
get-name-type
|
||||||
|
type-of
|
||||||
|
current-type-of
|
||||||
|
get-return-type
|
||||||
|
|
||||||
|
get-type-info
|
||||||
|
get-tag-info
|
||||||
|
get-fields
|
||||||
|
get-underlying-type
|
||||||
|
|
||||||
|
type-head?
|
||||||
|
named-arg?
|
||||||
|
named-arg-type
|
||||||
|
arglist-types
|
||||||
|
strip-pub
|
||||||
|
array-bound?
|
||||||
|
array-element-type)
|
||||||
|
|
||||||
;;; Two namespaces: `struct point' and a `point' typedef are separate
|
;;; Two namespaces: `struct point' and a `point' typedef are separate
|
||||||
;;; declarations. Tags -- struct, union and enum alike -- share the
|
;;; declarations. Tags -- struct, union and enum alike -- share the
|
||||||
;;; second table between them
|
;;; second table between them
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
(module utils
|
|
||||||
(get-env-var
|
|
||||||
set-working-directory
|
|
||||||
to-absolute-pathname
|
|
||||||
comment-form?
|
|
||||||
strip-header-comments
|
|
||||||
list-split
|
|
||||||
list-join
|
|
||||||
recons
|
|
||||||
current-source-file
|
|
||||||
set-form-source!
|
|
||||||
form-source
|
|
||||||
form-file
|
|
||||||
form-line
|
|
||||||
form-end-line
|
|
||||||
copy-form-source!
|
|
||||||
stamp-form-source!
|
|
||||||
form-location
|
|
||||||
set-form-type!
|
|
||||||
form-type
|
|
||||||
sex-error
|
|
||||||
sex-warning
|
|
||||||
with-directory
|
|
||||||
)
|
|
||||||
"utils.scm")
|
|
||||||
25
utils.scm
25
utils.scm
@@ -2,11 +2,36 @@
|
|||||||
scheme
|
scheme
|
||||||
(scheme base) ; make-parameter
|
(scheme base) ; make-parameter
|
||||||
(chicken base)
|
(chicken base)
|
||||||
|
(chicken module)
|
||||||
(chicken pathname)
|
(chicken pathname)
|
||||||
(chicken process-context)
|
(chicken process-context)
|
||||||
srfi-1
|
srfi-1
|
||||||
srfi-69)
|
srfi-69)
|
||||||
|
|
||||||
|
(export
|
||||||
|
get-env-var
|
||||||
|
set-working-directory
|
||||||
|
to-absolute-pathname
|
||||||
|
comment-form?
|
||||||
|
strip-header-comments
|
||||||
|
list-split
|
||||||
|
list-join
|
||||||
|
recons
|
||||||
|
current-source-file
|
||||||
|
set-form-source!
|
||||||
|
form-source
|
||||||
|
form-file
|
||||||
|
form-line
|
||||||
|
form-end-line
|
||||||
|
copy-form-source!
|
||||||
|
stamp-form-source!
|
||||||
|
form-location
|
||||||
|
set-form-type!
|
||||||
|
form-type
|
||||||
|
sex-error
|
||||||
|
sex-warning
|
||||||
|
with-directory)
|
||||||
|
|
||||||
(define-syntax prog1
|
(define-syntax prog1
|
||||||
(syntax-rules ()
|
(syntax-rules ()
|
||||||
((prog1 form . forms)
|
((prog1 form . forms)
|
||||||
|
|||||||
Reference in New Issue
Block a user