nith: introduce `nith` the ligHt Nit compiler
authorJean Privat <jean@pryen.org>
Mon, 28 Apr 2014 15:49:05 +0000 (11:49 -0400)
committerJean Privat <jean@pryen.org>
Mon, 28 Apr 2014 15:49:38 +0000 (11:49 -0400)
nith is just nitg with less features so, less phases to run,
and less code to compile (for a boostrap or test perspective).

Some numbers, note: `--skip-dead-methods` is used to produce less C code.

~~~
$ time nitg nitg.nit --skip-dead-methods
user 0m8.080s
$ time nitg nith.nit --skip-dead-methods
user 0m6.920s
~~~

Signed-off-by: Jean Privat <jean@pryen.org>

src/nith.nit [new file with mode: 0644]

diff --git a/src/nith.nit b/src/nith.nit
new file mode 100644 (file)
index 0000000..6fb477d
--- /dev/null
@@ -0,0 +1,46 @@
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2012 Jean Privat <jean@pryen.org>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# A ligHt Nit compiler
+module nith
+
+import phase
+import literal
+import scope
+import flow
+import local_var_init
+import typing
+import auto_super_init
+import modelbuilder
+import rapid_type_analysis
+import separate_erasure_compiler
+import transform
+
+redef class ToolContext
+       redef fun process_options(args)
+       do
+               super
+
+               var sum = opt_separate.value.to_i + opt_erasure.value.to_i
+               if sum > 1 then
+                       print "Options --separate and --erasure are exclusive"
+                       exit(1)
+               else if sum == 0 then
+                       # --separate by default
+                       opt_separate.value = true
+               end
+       end
+end