The behavior of the interpreter may differs slightly from the compiler.
First, the interpreted is the reference implementation for the specification of the Nit language.
-That means if `nitg` and `nit` have a different behavior on a same program, it is likely that `nit` is right and `nitg` is wrong.
+That means if `nitc` and `nit` have a different behavior on a same program, it is likely that `nit` is right and `nitc` is wrong.
Second, the FFI is not yet implemented in the interpreter.
Only a subset of the standard methods are implemented with some hard-coded behaviors.
While it is enough to use most of the standard library, a lot of additional libraries may not be usable by the interpreter.
-Last, `nit` is the *Naive Interpretation Tool*, it means that it is slow and may take an average of 50.000% in overhead comparatively to `nitg`(it also means that `nitg` is fast).
+Last, `nit` is the *Naive Interpretation Tool*, it means that it is slow and may take an average of 50.000% in overhead comparatively to `nitc`(it also means that `nitc` is fast).
In practice, the slowness is not an issue for simple Nit scripts;
-it is not a big deal if `nit` takes millisecond to execute programs even if `nitg` only need microseconds.
+it is not a big deal if `nit` takes millisecond to execute programs even if `nitc` only need microseconds.
# OPTIONS
-Most options are the same than `nitg(1)`.
+Most options are the same than `nitc(1)`.
Here, only the specific one are indicated.
Note that, unlike in other Nit tools, the options *MUST* be indicated before the main module of a program.
# NAME
-nitg - compiles Nit programs.
+nitc - compiles Nit programs.
# SYNOPSIS
-nitg [*options*] FILE...
+nitc [*options*] FILE...
# DESCRIPTION
-nitg is the current official Nit compiler.
+nitc is the current official Nit compiler.
It takes the main module of a Nit program as argument and produces an executable file.
By default, the generated executables are produced in the current directory.
(see `--dir` for details.)
-Internally, nitg rely on the presence of a C compiler. Usually gcc (but nitg was successfully tested with clang).
+Internally, nitc rely on the presence of a C compiler. Usually gcc (but nitc was successfully tested with clang).
A compilation directory is therefore created and (re-)used.
By default, the compilation directory is named `.nit_compile`.
(see `--compile-dir` for details.)
To improve the compilation time and simplify the compilation of multiple programs, more than one file can be given.
Each one will be compiled into a distinct executable.
- $ nitg prog1.nit prog2.nit
+ $ nitc prog1.nit prog2.nit
To combine files into a single program, use the `-m` option.
- $ nitg prog1.nit -m other_module.nit
+ $ nitc prog1.nit -m other_module.nit
-nitg can produces executables for various platforms when specific modules are used.
+nitc can produces executables for various platforms when specific modules are used.
Currently, android, pnacl and emscripten are supported.
See the documentation of these specific modules for details.
To show only `missing-doc` warnings in standard"
- $ nitg -q -w missing-doc standard
+ $ nitc -q -w missing-doc standard
To show all warnings and advices, except `missing-doc`:
- $ nitg -W -w no-missing-doc standard
+ $ nitc -W -w no-missing-doc standard
To show important warnings except `useless-type-test`, but not advice except `missing-doc`:
- $ nitg -w missing-doc -w no-useless-type-test standard
+ $ nitc -w missing-doc -w no-useless-type-test standard
`-q`, `--quiet`
: Do not show warnings.
`--stop-on-first-error`
: Just display the first encountered error then stop.
- By default, nitg tries to detect and display more than one error before aborting the compilation.
+ By default, nitc tries to detect and display more than one error before aborting the compilation.
`--no-color`
: Do not use color to display errors and warnings.
This option is mainly used to produce C files distributable then compilable on system that do not have a Nit compiler (e.g. embedded system).
In this case, it is suggested to also use the options `--dir`, `--compile-dir` and `--semi-global`.
- $ nitg examples/hello_world.nit --no-cc --dir hello --compile-dir hello --semi-global
+ $ nitc examples/hello_world.nit --no-cc --dir hello --compile-dir hello --semi-global
Will produce a `hello` directory that contains the required C files to finish the compilation.
Only the C files required for the program are generated.
A last usage is to develop programs as product lines with a main basic module (vanilla) and specific distinct features as flavor modules, then to combine them at compile-time.
- $ nitg prog_vanilla.nit -m feature_chocolate.nit -m feature_cherry.nit
+ $ nitc prog_vanilla.nit -m feature_chocolate.nit -m feature_cherry.nit
`-D`, `--define`
: Define a specific property.
The argument of the `-D` option is "{name}={value}".
For Bool, the argument can also be just "{name}", in this case, the value is considered to be `true`.
- $ nitg foo.nit -D prefix=/opt/foo -D port=8080 -D with_ssl
+ $ nitc foo.nit -D prefix=/opt/foo -D port=8080 -D with_ssl
`--release`
: Compile in release mode and finalize application.
## COMPILATION MODES
-`nitg` includes distinct compilation modes.
+`nitc` includes distinct compilation modes.
`--separate`
: Use separate compilation (default mode).
`--make-flags`
: Additional options to the `make` command.
- $ nitg foo.nit --make-flags 'CC=clang' --make-flags 'CFLAGS="-O0 -g"'
+ $ nitc foo.nit --make-flags 'CC=clang' --make-flags 'CFLAGS="-O0 -g"'
`--typing-test-metrics`
: Enable static and dynamic count of all type tests.
`NIT_GC_OPTION`
: Runtime control of the garbage collector.
- The behavior of the GC of the executables produced by nitg can be tuned with this environment variable.
+ The behavior of the GC of the executables produced by nitc can be tuned with this environment variable.
The environment variable is used when programs are executed, not when they are compiled.
Thus, you do not need to recompile programs in order to tweak their GC options.