aboutsummaryrefslogtreecommitdiff
path: root/src/lux.clj
blob: 8cd2c4b80a9838c65c11798b7cf806579b16450b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
;;  Copyright (c) Eduardo Julian. All rights reserved.
;;  This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
;;  If a copy of the MPL was not distributed with this file,
;;  You can obtain one at http://mozilla.org/MPL/2.0/.

(ns lux
  (:gen-class)
  (:require [lux.base :as & :refer [|let |do return fail return* fail* |case]]
            [lux.compiler.base :as &compiler-base]
            [lux.compiler :as &compiler]
            [lux.packager.lib :as &lib]
            :reload-all)
  (:import (java.io File)))

(defn -main [& args]
  (|case (&/->list args)
    (&/$Cons "compile" (&/$Cons program-module (&/$Nil)))
    (if program-module
      (time (&compiler/compile-program program-module))
      (println "Please provide a module name to compile."))

    (&/$Cons "lib" (&/$Cons lib-module (&/$Nil)))
    (&lib/package lib-module (new File &compiler-base/input-dir))

    _
    (println "Can't understand command."))
  ;; (System/exit 0)
  )

(comment
  (-main "compile" "program")
  (-main "lib" "lux")
  )