Complete the documentation on the Gambit backend

This commit is contained in:
Abdelhakim Qbaich 2020-05-02 00:05:36 -04:00
parent d44690ed3e
commit 281d32aeef
4 changed files with 53 additions and 5 deletions

View File

@ -1,7 +1,7 @@
# Installation
Idris 2 is built using Idris, and provides support for two default code
generation targets: Chez Scheme, and Racket. To build from source, it requires
generation targets: Chez Scheme, Racket, and Gambit. To build from source, it requires
at least Idris version 1.3.2 (see https://www.idris-lang.org/pages/download.html). You
can also build from the generated C.
@ -64,7 +64,7 @@ you run `./configure --threads` to build multithreading support in.
### Chicken
Chicken scheme offers binary distributions (and source tar balls) from
Chicken Scheme offers binary distributions (and source tar balls) from
+ https://code.call-cc.org/
@ -87,3 +87,14 @@ The following packages are required in order to run Idris:
- math-lib
These can be installed with `raco setup` and `raco pkg install`.
### Gambit
Gambit Scheme offers binary releases and source tarballs on
http://gambitscheme.org.
GNU/Linux users can usually find a package on their distribution under one of
the following names: `gambit`, `gambit-c` or `gambc`.
The default backend of Gambit is C, so you are expected to have a C compiler
(GCC preferred).

View File

@ -112,7 +112,7 @@ Syntax:
The given instructions are passed directly to the code generator, to be
interpreted in a backend-specific way.
Currently known backends are: `chez`, `chicken` and `racket`.
Currently known backends are: `chez`, `chicken`, `racket` and `gambit`.
## Backend Specific Directives

View File

@ -0,0 +1,36 @@
****************************
Gambit Scheme Code Generator
****************************
The Gambit Scheme code generator can be accessed via the REPL command:
::
Main> :set cg gambit
Ergo, to run Idris programs with this generator, you will need to install
`Gambit Scheme <https://gambitscheme.org>`_. Gambit Scheme is free software,
and available via most pacakge managers.
You can compile an expression ``expr`` of type ``IO ()`` to an executable as
follows, at the REPL:
::
Main> :c execname expr
...where ``execname`` is the name of the executable file. This will generate
the following:
* An executable binary ``build/exec/execname`` of the program.
* A Gambit Scheme source file ``build/exec/execname.scm``, from which the
binary is generated.
You can also execute an expression directly:
::
Main> :exec expr
Again, ``expr`` must have type ``IO ()``. This will generate a temporary
Scheme file, and execute the Gambit interpreter on it.

View File

@ -646,8 +646,9 @@ Chez Scheme target
------------------
The default code generator is, for the moment, `Chez Scheme
<https://www.scheme.com/>`_. A Racket code generator is also available. There
is not yet a way to plug in code generators as in Idris 1, but this is coming.
<https://www.scheme.com/>`_. Racket and Gambit code generators are also
available. There is not yet a way to plug in code generators as in Idris 1,
but this is coming.
To change the code generator, you can use the ``:set cg`` command:
::