mirror of
https://github.com/edwinb/Idris2-boot.git
synced 2024-09-11 16:05:51 +03:00
Preparation for the Gambit Scheme backend
This commit is contained in:
parent
45d02a11b7
commit
1bbf662609
2
Makefile
2
Makefile
@ -143,9 +143,11 @@ install-support:
|
||||
mkdir -p ${PREFIX}/idris2-${IDRIS2_VERSION}/support/chez
|
||||
mkdir -p ${PREFIX}/idris2-${IDRIS2_VERSION}/support/chicken
|
||||
mkdir -p ${PREFIX}/idris2-${IDRIS2_VERSION}/support/racket
|
||||
mkdir -p ${PREFIX}/idris2-${IDRIS2_VERSION}/support/gambit
|
||||
install support/chez/* ${PREFIX}/idris2-${IDRIS2_VERSION}/support/chez
|
||||
install support/chicken/* ${PREFIX}/idris2-${IDRIS2_VERSION}/support/chicken
|
||||
install support/racket/* ${PREFIX}/idris2-${IDRIS2_VERSION}/support/racket
|
||||
install support/gambit/* ${PREFIX}/idris2-${IDRIS2_VERSION}/support/gambit
|
||||
|
||||
install-exec:
|
||||
mkdir -p ${PREFIX}/bin
|
||||
|
@ -58,8 +58,8 @@ Summary of new features:
|
||||
+ Better type checker implementation which minimises the need for compile
|
||||
time evaluation.
|
||||
+ New Chez Scheme based back end which both compiles and runs faster than the
|
||||
default Idris 1 back end. (Also, optionally, Chicken Scheme and Racket can
|
||||
be used as targets).
|
||||
default Idris 1 back end. (Also, optionally, Chicken Scheme, Racket and Gambit
|
||||
can be used as targets).
|
||||
+ Everything works faster :).
|
||||
|
||||
A significant change in the implementation is that there is an intermediate
|
||||
|
@ -37,13 +37,14 @@ You can also execute expressions directly:
|
||||
|
||||
Again, ``expr`` must have type ``IO ()``.
|
||||
|
||||
There are two code generators provided in Idris 2, and (later) there will be
|
||||
There are three code generators provided in Idris 2, and (later) there will be
|
||||
a system for plugging in new code generators for a variety of targets. The
|
||||
default is to compile via Chez Scheme, with an alternative via Racket.
|
||||
default is to compile via Chez Scheme, with an alternative via Racket or Gambit.
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
chez
|
||||
racket
|
||||
gambit
|
||||
|
||||
|
@ -24,8 +24,8 @@ example, in C:
|
||||
|
||||
It is up to specific code generators to decide how to locate the function and
|
||||
the library. In this document, we will assume the default Chez Scheme code
|
||||
generator (the examples also work with the Racket code generator) and that the
|
||||
foreign language is C.
|
||||
generator (the examples also work with the Racket or Gambit code generator) and
|
||||
that the foreign language is C.
|
||||
|
||||
Example
|
||||
-------
|
||||
|
@ -12,7 +12,7 @@ Foreign Function Interface
|
||||
More information concerning the CC0 can be found online at: http://creativecommons.org/publicdomain/zero/1.0/
|
||||
|
||||
Idris 2 is designed to support multiple code generators. The default target is
|
||||
Chez Scheme, with a Racket code generator also supported. However, the
|
||||
Chez Scheme, with Racket and Gambit code generators also supported. However, the
|
||||
intention is, as with Idris 1, to support multiple targets on multiple platforms,
|
||||
including e.g. JavaScript, JVM, .NET, and others yet to be invented.
|
||||
This makes the design of a foreign function interface (FFI), which calls
|
||||
|
@ -9,6 +9,7 @@ modules =
|
||||
Compiler.Scheme.Chez,
|
||||
-- Compiler.Scheme.Chicken,
|
||||
Compiler.Scheme.Racket,
|
||||
Compiler.Scheme.Gambit,
|
||||
Compiler.Scheme.Common,
|
||||
Compiler.VMCode,
|
||||
|
||||
|
@ -1,11 +1,12 @@
|
||||
package idris2api
|
||||
|
||||
modules =
|
||||
modules =
|
||||
Compiler.Common,
|
||||
Compiler.CompileExpr,
|
||||
Compiler.Inline,
|
||||
Compiler.Scheme.Chez,
|
||||
Compiler.Scheme.Racket,
|
||||
Compiler.Scheme.Gambit,
|
||||
Compiler.Scheme.Common,
|
||||
|
||||
Control.Delayed,
|
||||
|
@ -35,12 +35,14 @@ public export
|
||||
data CG = Chez
|
||||
| Chicken
|
||||
| Racket
|
||||
| Gambit
|
||||
|
||||
export
|
||||
Eq CG where
|
||||
Chez == Chez = True
|
||||
Chicken == Chicken = True
|
||||
Racket == Racket = True
|
||||
Gambit == Gambit = True
|
||||
_ == _ = False
|
||||
|
||||
export
|
||||
@ -48,7 +50,8 @@ availableCGs : List (String, CG)
|
||||
availableCGs
|
||||
= [("chez", Chez),
|
||||
("chicken", Chicken),
|
||||
("racket", Racket)]
|
||||
("racket", Racket),
|
||||
("gambit", Gambit)]
|
||||
|
||||
export
|
||||
getCG : String -> Maybe CG
|
||||
|
@ -718,12 +718,14 @@ TTC CG where
|
||||
toBuf b Chez = tag 0
|
||||
toBuf b Chicken = tag 1
|
||||
toBuf b Racket = tag 2
|
||||
toBuf b Gambit = tag 3
|
||||
|
||||
fromBuf b
|
||||
= case !getTag of
|
||||
0 => pure Chez
|
||||
1 => pure Chicken
|
||||
2 => pure Racket
|
||||
3 => pure Gambit
|
||||
_ => corrupt "CG"
|
||||
|
||||
export
|
||||
|
@ -3,6 +3,7 @@ module Idris.IDEMode.REPL
|
||||
import Compiler.Scheme.Chez
|
||||
-- import Compiler.Scheme.Chicken
|
||||
import Compiler.Scheme.Racket
|
||||
import Compiler.Scheme.Gambit
|
||||
import Compiler.Common
|
||||
|
||||
import Core.AutoSearch
|
||||
|
@ -3,6 +3,7 @@ module Idris.REPL
|
||||
import Compiler.Scheme.Chez
|
||||
-- import Compiler.Scheme.Chicken
|
||||
import Compiler.Scheme.Racket
|
||||
import Compiler.Scheme.Gambit
|
||||
import Compiler.Common
|
||||
|
||||
import Core.AutoSearch
|
||||
@ -241,6 +242,7 @@ findCG
|
||||
Chicken => throw (InternalError "Chicken CG not available")
|
||||
-- pure codegenChicken
|
||||
Racket => pure codegenRacket
|
||||
Gambit => pure codegenGambit
|
||||
|
||||
anyAt : (FC -> Bool) -> FC -> a -> Bool
|
||||
anyAt p loc y = p loc
|
||||
|
Loading…
Reference in New Issue
Block a user