Login
7 branches 0 tags
Ben (Win10) Moved win32 over to use readline 2a5d70f 4 years ago 194 Commits
nujel / tools / bootstrap.nuj
#!/usr/bin/env nujel

[def new-env [ω]]
[def ext-nuj? [path/ext?! "nuj"]]
[def directory/read-relative [λ [path]
       [map [λ [α] [cat path "/" α]]
            [directory/read path]]
]]

[def stdlib-files [filter ext-nuj? [append [directory/read-relative "stdlib"]
                                           [directory/read-relative "binlib"]]]]

[println [ansi-green "Starting the Eval Bootstrap phase!"]]
[try [λ [err] [println "Exception during stdlib eval"] [display/error err] [exit 1]]
     [for-each [λ [cur-path]
                  [println [cat [ansi-yellow " [EVA]  "] cur-path]]
                  [def file [compile [cons 'do [read [file/read cur-path]]]]]
                  [apply new-env [list [list 'eval* file]]]
	       ]
               stdlib-files]
]

[println [ansi-green "Starting the Compile phase!"]]
[try [λ [err] [println "Exception during stdlib compilation"] [display/error err] [exit 2]]
     [for-each [λ [cur-path]
                  [println [cat [ansi-green " [NUJ]  "] cur-path]]
                  [apply new-env [list [list 'file/compile cur-path]]]
               ]
               stdlib-files]
]