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
|
||||
|
||||
- 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
|
||||
there is no concept of macro expansion, probably other deficiencies as well
|
||||
|
|
37
cyclone.scm
37
cyclone.scm
|
@ -5,14 +5,24 @@
|
|||
;; This module contains a front-end for the compiler itself.
|
||||
;;
|
||||
|
||||
; TODO:
|
||||
;(import (scheme base)
|
||||
; (scheme file)
|
||||
; (scheme read)
|
||||
; (scheme write)
|
||||
; (scheme cyclone util)
|
||||
; (scheme cyclone cgen)
|
||||
; (scheme cyclone transforms)
|
||||
; (scheme cyclone libraries))
|
||||
|
||||
(cond-expand
|
||||
(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/")
|
||||
|
||||
(cond-expand
|
||||
(chicken
|
||||
;; END TODO
|
||||
(require-extension extras) ;; pretty-print
|
||||
(require-extension chicken-syntax) ;; when
|
||||
(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) "transforms.so"))
|
||||
(load (string-append (cyc:get-lib-dir) "cgen.so")))
|
||||
; (husk
|
||||
; (import (husk pretty-print))
|
||||
; ;; TODO: load files
|
||||
; )
|
||||
(else
|
||||
(load (string-append (cyc:get-lib-dir) "parser.scm"))
|
||||
(load (string-append (cyc:get-lib-dir) "util.scm"))
|
||||
(load (string-append (cyc:get-lib-dir) "libraries.scm"))
|
||||
(load (string-append (cyc:get-lib-dir) "transforms.scm"))
|
||||
(load (string-append (cyc:get-lib-dir) "cgen.scm"))))
|
||||
(else #f))
|
||||
;; (husk
|
||||
;; (import (husk pretty-print))
|
||||
;; ;; TODO: load files
|
||||
;; )
|
||||
; (else
|
||||
; (load (string-append (cyc:get-lib-dir) "parser.scm"))
|
||||
; (load (string-append (cyc:get-lib-dir) "util.scm"))
|
||||
; (load (string-append (cyc:get-lib-dir) "libraries.scm"))
|
||||
; (load (string-append (cyc:get-lib-dir) "transforms.scm"))
|
||||
; (load (string-append (cyc:get-lib-dir) "cgen.scm"))))
|
||||
|
||||
;; Code emission.
|
||||
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
;; 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
|
||||
(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)
|
||||
(tagged-list? 'define-library ast))
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
(define-library (scheme base)
|
||||
(export
|
||||
*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
|
||||
;delete
|
||||
;delete-duplicates
|
||||
|
|
|
@ -4,6 +4,9 @@
|
|||
(scheme cyclone util)
|
||||
)
|
||||
(export
|
||||
cyc:get-clib-dir
|
||||
cyc:get-lib-dir
|
||||
cyc:get-include-dir
|
||||
library?
|
||||
lib:name
|
||||
lib:name->string
|
||||
|
|
Loading…
Add table
Reference in a new issue