on a20cb92 help sign in
Idris-dev/docs/reference/compilation.rst
131 lines 5.1 kB history raw
1************************************
2Compilation, Logging, and Reporting
3************************************
5This section provides information about the Idris compilation process, and
6provides details over how you can follow the process through logging.
8Compilation Process
9===================
11Idris follows the following compilation process:
13#. Parsing
14#. Type Checking
16 #. Elaboration
17 #. Coverage
18 #. Unification
19 #. Totality Checking
20 #. Erasure
22#. Code Generation
24 #. Defunctionalisation
25 #. Inlining
26 #. Resolving variables
27 #. Code Generation
30Type Checking Only
31==================
33With Idris you can ask it to terminate the compilation process after type checking has completed. This is achieved through use of either:
35+ The command line options
37 + ``--check`` for files
38 + ``--checkpkg`` for packages
40+ The REPL command: ``:check``
42Use of this option will still result in the generation of the Idris binary ``.ibc`` files, and is suitable if you do not wish to generate code from one of the supported backends.
44Reporting Compilation Process
45=============================
47During compilation the reporting of Idris' progress can be controlled
48by setting a verbosity level.
50+ ``-V``, or alternatively ``--verbose`` and ``--V0``, will report which file Idris is currently type checking.
51+ ``--V1`` will additionally report: Parsing, IBC Generation, and Code
52 Generation.
53+ ``--V2`` will additionally report: Totality Checking, Universe
54 Checking, and the individual steps prior to code generation.
57By default Idris' progress reporting is set to quiet-``-q``, or ``--quiet``.
59Logging Internal Operation
60===========================
62For those that develop on the Idris compiler, the internal operation
63of Idris is captured using a category based logger. Currently, the
64logging infrastructure has support for the following categories:
66+ Parser (``parser``)
67+ Elaborator (``elab``)
68+ Code generation (``codegen``)
69+ Erasure (``erasure``)
70+ Coverage Checking (``coverage``)
71+ IBC generation (``ibc``)
74These categories are specified using the command-line option:
75``--logging-categories CATS``, where ``CATS`` is a quoted colon
76separated string of the categories you want to see. By default if this
77option is not specified all categories are allowed. Sub-categories
78have yet to be defined but will be in the future, especially for the
79elaborator.
81Further, the verbosity of logging can be controlled by specifying a
82logging level between: 1 to 10 using the command-line option: ``--log
83<level>``.
85+ Level 0: Show no logging output. Default level
86+ Level 1: High level details of the compilation process.
87+ Level 2: Provides details of the coverage checking, and further details the elaboration process specifically: Interface, Clauses, Data, Term, and Types,
88+ Level 3: Provides details of compilation of the IRTS, erasure, parsing, case splitting, and further details elaboration of: Implementations, Providers, and Values.
89+ Level 4: Provides further details on: Erasure, Coverage Checking, Case splitting, and elaboration of clauses.
90+ Level 5: Provides details on the prover, and further details elaboration (adding declarations) and compilation of the IRTS.
91+ Level 6: Further details elaboration and coverage checking.
92+ Level 7:
93+ Level 8:
94+ Level 9:
95+ Level 10: Further details elaboration.
97Environment Variables
98=====================
100Several paths set by default within the Idris compiler can be
101overridden through environment variables. The provided variables are:
103* `IDRIS_CC` Change the `C` compiler used by the `C` backend.
104* `IDRIS_CFLAGS` Change the `C` flags passed to the `C` compiler.
105* `TARGET` Change the target directory i.e. `data dir` where Idris installs files when installing using Cabal/Stack.
106* `IDRIS_LIBRARY_PATH` Change the location of where installed packages are found/installed.
107* `IDRIS_DOC_PATH` Change the location of where generated idrisdoc for packages are installed.
109.. note::
111 In versions of Idris prior to 0.12.3 the environment variables
112 `IDRIS_LIBRARY_PATH` and `TARGET` were both used to affect the
113 installation of single packages and direct where Idris installed
114 its data. The meaning of these variables has changed, and command
115 line options are preferred when changing where individual packages
116 are installed.
118The CLI option `--ibcsubdir` can be used to direct where generated IBC
119files are placed. However, this means Idris will install files in a
120non-standard location separate from the rest of the installed
121packages. The CLI option `--idrispath <dir>` allows you to add a
122directory to the library search path; this option can be used multiple
123times and can be shortened to `-i <dir>`. Similary, the `--sourcepath
124<dir>` option can be used to add directories to the source search
125path. There is no shortened version for this option as `-s` is a
126reserved flag.
128Further, Idris also supports options to augment the paths used, and
129pass options to the code generator backend. The option `--cg-opt
130<ARG>` can be used to pass options to the code generator. The format
131of `<ARG>` is dependent on the selected backend.