mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-08 21:47:33 +02:00
WIP - compilation of main module
This commit is contained in:
parent
d41e5b0d46
commit
ce7c4dc9a9
5 changed files with 37 additions and 15 deletions
4
TODO
4
TODO
|
@ -13,6 +13,10 @@ Working TODO list:
|
||||||
- Constructs require for self-hosting
|
- Constructs require for self-hosting
|
||||||
|
|
||||||
- modify main cyclone.scm program to compile
|
- modify main cyclone.scm program to compile
|
||||||
|
1) Need to add support:
|
||||||
|
Error: Unbound variable(s): (command-line-arguments string-ref)
|
||||||
|
|
||||||
|
2) Need to either allow code to read an import after macro expansion, or have another main module for self-hosting
|
||||||
|
|
||||||
- eval
|
- eval
|
||||||
there is no concept of macro expansion, probably other deficiencies as well
|
there is no concept of macro expansion, probably other deficiencies as well
|
||||||
|
|
41
cyclone.scm
41
cyclone.scm
|
@ -5,14 +5,24 @@
|
||||||
;; This module contains a front-end for the compiler itself.
|
;; This module contains a front-end for the compiler itself.
|
||||||
;;
|
;;
|
||||||
|
|
||||||
;; TODO: will need to read these from env somehow.
|
; TODO:
|
||||||
;; for now they are just hard-coded, but that won't work for an install
|
;(import (scheme base)
|
||||||
(define (cyc:get-lib-dir) "/home/justin/Documents/cyclone/")
|
; (scheme file)
|
||||||
(define (cyc:get-clib-dir) "/home/justin/Documents/cyclone/")
|
; (scheme read)
|
||||||
(define (cyc:get-include-dir) "/home/justin/Documents/cyclone/")
|
; (scheme write)
|
||||||
|
; (scheme cyclone util)
|
||||||
|
; (scheme cyclone cgen)
|
||||||
|
; (scheme cyclone transforms)
|
||||||
|
; (scheme cyclone libraries))
|
||||||
|
|
||||||
(cond-expand
|
(cond-expand
|
||||||
(chicken
|
(chicken
|
||||||
|
;; TODO: will need to read these from env somehow.
|
||||||
|
;; for now they are just hard-coded, but that won't work for an install
|
||||||
|
(define (cyc:get-lib-dir) "/home/justin/Documents/cyclone/")
|
||||||
|
(define (cyc:get-clib-dir) "/home/justin/Documents/cyclone/")
|
||||||
|
(define (cyc:get-include-dir) "/home/justin/Documents/cyclone/")
|
||||||
|
;; END TODO
|
||||||
(require-extension extras) ;; pretty-print
|
(require-extension extras) ;; pretty-print
|
||||||
(require-extension chicken-syntax) ;; when
|
(require-extension chicken-syntax) ;; when
|
||||||
(require-extension srfi-1) ;; every
|
(require-extension srfi-1) ;; every
|
||||||
|
@ -21,16 +31,17 @@
|
||||||
(load (string-append (cyc:get-lib-dir) "libraries.so"))
|
(load (string-append (cyc:get-lib-dir) "libraries.so"))
|
||||||
(load (string-append (cyc:get-lib-dir) "transforms.so"))
|
(load (string-append (cyc:get-lib-dir) "transforms.so"))
|
||||||
(load (string-append (cyc:get-lib-dir) "cgen.so")))
|
(load (string-append (cyc:get-lib-dir) "cgen.so")))
|
||||||
; (husk
|
(else #f))
|
||||||
; (import (husk pretty-print))
|
;; (husk
|
||||||
; ;; TODO: load files
|
;; (import (husk pretty-print))
|
||||||
; )
|
;; ;; TODO: load files
|
||||||
(else
|
;; )
|
||||||
(load (string-append (cyc:get-lib-dir) "parser.scm"))
|
; (else
|
||||||
(load (string-append (cyc:get-lib-dir) "util.scm"))
|
; (load (string-append (cyc:get-lib-dir) "parser.scm"))
|
||||||
(load (string-append (cyc:get-lib-dir) "libraries.scm"))
|
; (load (string-append (cyc:get-lib-dir) "util.scm"))
|
||||||
(load (string-append (cyc:get-lib-dir) "transforms.scm"))
|
; (load (string-append (cyc:get-lib-dir) "libraries.scm"))
|
||||||
(load (string-append (cyc:get-lib-dir) "cgen.scm"))))
|
; (load (string-append (cyc:get-lib-dir) "transforms.scm"))
|
||||||
|
; (load (string-append (cyc:get-lib-dir) "cgen.scm"))))
|
||||||
|
|
||||||
;; Code emission.
|
;; Code emission.
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
;; this is problematic as it has to work for the bootstrap and the actual cyclone comp.
|
;; this is problematic as it has to work for the bootstrap and the actual cyclone comp.
|
||||||
;; although I suppose it would be OK if you have to bootstrap from a hardcoded dir
|
;; although I suppose it would be OK if you have to bootstrap from a hardcoded dir
|
||||||
(define (cyc:get-lib-dir) "/home/justin/Documents/cyclone/")
|
(define (cyc:get-lib-dir) "/home/justin/Documents/cyclone/")
|
||||||
|
(define (cyc:get-clib-dir) "/home/justin/Documents/cyclone/")
|
||||||
|
(define (cyc:get-include-dir) "/home/justin/Documents/cyclone/")
|
||||||
|
|
||||||
(define (library? ast)
|
(define (library? ast)
|
||||||
(tagged-list? 'define-library ast))
|
(tagged-list? 'define-library ast))
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
(define-library (scheme base)
|
(define-library (scheme base)
|
||||||
(export
|
(export
|
||||||
*Cyc-version-banner*
|
*Cyc-version-banner*
|
||||||
|
*c-file-header-comment*
|
||||||
|
*version-banner*
|
||||||
; TODO: need filter for the next two. also, they really belong in SRFI-1, not here
|
; TODO: need filter for the next two. also, they really belong in SRFI-1, not here
|
||||||
;delete
|
;delete
|
||||||
;delete-duplicates
|
;delete-duplicates
|
||||||
|
|
|
@ -4,6 +4,9 @@
|
||||||
(scheme cyclone util)
|
(scheme cyclone util)
|
||||||
)
|
)
|
||||||
(export
|
(export
|
||||||
|
cyc:get-clib-dir
|
||||||
|
cyc:get-lib-dir
|
||||||
|
cyc:get-include-dir
|
||||||
library?
|
library?
|
||||||
lib:name
|
lib:name
|
||||||
lib:name->string
|
lib:name->string
|
||||||
|
|
Loading…
Add table
Reference in a new issue