Commit Graph

1181 Commits

Author SHA1 Message Date
Edwin Brady
158b6fb4dc
Merge pull request #347 from ziman/fix-racket
Fix order of arguments in write-string for Racket
2020-05-09 13:10:22 +01:00
Edwin Brady
afa9352dd3
Merge pull request #329 from LibreCybernetics/refactor-identifier-lexer
Refactor identChar into the identLexer to have that definition in one place
2020-05-09 13:09:59 +01:00
Edwin Brady
7e06798ebf
Merge pull request #340 from chrrasmussen/add-nonewtype
Add noNewtype option to data types
2020-05-09 13:09:00 +01:00
Edwin Brady
595093f34e
Merge pull request #358 from rgrover/system.clock
Add System.Clock to fetch current time for various clock types.
2020-05-09 12:57:23 +01:00
Edwin Brady
5a81884d2b
Merge branch 'master' into system.clock 2020-05-09 12:57:10 +01:00
Edwin Brady
600412f9f3
Merge pull request #354 from rgrover/system.random
Add System.Random
2020-05-09 12:54:23 +01:00
Edwin Brady
a7e0f63d16
Merge pull request #353 from ska80/fix-cast-char-string
Fix casting Char to String
2020-05-09 12:53:09 +01:00
Edwin Brady
2cfcea0484
Merge pull request #339 from ziman/traversable-map
Make SortedMap foldable and traversable
2020-05-09 12:50:20 +01:00
Edwin Brady
73223270f4
Merge pull request #337 from ziman/traversable-vect
Export the implementation of `Traversable (Vect k)`
2020-05-09 12:45:41 +01:00
Edwin Brady
833168fe96
Merge pull request #317 from abdelq/gambit
Including a Gambit Scheme backend
2020-05-09 12:39:34 +01:00
Rohit Grover
fa94713a2a minor reorganization and cleanup of Clock.idr 2020-05-09 18:07:20 +12:00
Rohit Grover
5ceee18a36 fix comment describing the UTC clock type 2020-05-09 18:00:35 +12:00
Rohit Grover
edb063eb50 Add System.Clock to fetch current time for various clock types. 2020-05-09 17:21:23 +12:00
Fabián Heredia Montiel
20ed4a3ae4 Refactor identChar into the identLexer to have that definition in one place
Furthermore, remove chars on [127..160] as ident characters since those are
control characters
2020-05-07 23:52:41 -05:00
Edwin Brady
1fe78c7f06 Complete basic partial evaluation mechanism
This more or less follows the rules from ICFP '10 "Scrapping your
inefficient engine" in that it generates new partially evaluated
definitions by evaluating with the statically known arguments, and
caches the results so that they can be reused if the evaluator
encounters them again. Some polish is still needed:
- proper tests
- nice display of residual programs (which will help with proper tests!)
- sensible handling of partial functions (probably a small limit on how
much to evaluate, and fail on encountering it?)
- checking whether evaluation has made progress, and failing if not

Once the above works, we're in a position to start specialising
interfaces, which is the main point of this.
2020-05-08 00:13:44 +01:00
Edwin Brady
b7e395565a Calculate which arguments are inferrable in a type
Useful in partial evaluation, because if we erase the inferrable
arguments in an argument to a partially evaluated definition, we can
make something more general. It might also be useful in interactive
editing later, to decide what to display.
2020-05-07 19:41:55 +01:00
Rohit Grover
5e9a46163e add contrib to the search path for modules 2020-05-07 21:42:37 +12:00
Rohit Grover
a190408aa1 add srand to allow setting the random seed 2020-05-07 21:41:04 +12:00
Abdelhakim Qbaich
0541a8c74e Increase the inlining limit for Gambit 2020-05-07 03:11:41 -04:00
Abdelhakim Qbaich
1fb84ca255 Further tweaks to Gambit support file 2020-05-07 03:11:41 -04:00
Rohit Grover
834ae95256 introduce utilities rndFin and rndSelect 2020-05-07 18:01:35 +12:00
Rohit Grover
dcd19a5966 rewrite let statements according to style conventions 2020-05-07 10:46:39 +12:00
Rohit Grover
2fc589aa76 remove a couple of trailing wheres 2020-05-07 10:08:55 +12:00
Rohit Grover
c8e4210289 relocating System/Random.idr under libs/contrib 2020-05-07 10:06:13 +12:00
Edwin Brady
a117a63885 More progress on partial evaluation
Flag definitions as partial evaluation definitions, in which case the
RHS gets evaluated under certain limits (not yet defined...), pausing at
any new specialisable calls to recursively specialise.

Still to do: set appropriate reduction limits depending on
partiality/totality of functions concerned, and introduce transformation
rules for rewriting by already known and cached specialisations.
2020-05-06 13:22:41 +01:00
Rohit Grover
7cfb3419cb Add System.Random 2020-05-06 11:26:58 +12:00
Kamil Shakirov
6c27a43b5f Fix casting Char to String 2020-05-05 15:30:19 +06:00
Edwin Brady
a3c2163aba Progress on specialisation
Generate the initial definition of a specialised function, by applying
the function to its static arguments.
Next step: evaluate the RHS on elaboration.
2020-05-04 21:08:39 +01:00
Edwin Brady
30b609d55f readFile needs a newline
This isn't strictly right yet (there should be no newline on the last
lie if there was no newline in the input file) but it puts the behaviour
back to what it was before fGetLine was changed to discard it.

This needs revisiting...
2020-05-04 21:05:51 +01:00
Abdelhakim Qbaich
0758e33a11 Faster compile time on the Gambit backend
With optimization for dead definitions enabled
2020-05-03 17:37:39 -04:00
Abdelhakim Qbaich
281d32aeef Complete the documentation on the Gambit backend 2020-05-03 17:37:39 -04:00
Abdelhakim Qbaich
d44690ed3e Improving the Gambit backend for FFI support 2020-05-03 17:37:39 -04:00
Abdelhakim Qbaich
21ef0ddb43 Improving support file of Gambit 2020-05-03 17:37:39 -04:00
Matus Tejiscak
50c9531efd Fix order of arguments in write-string for Racket. 2020-05-02 19:21:02 +02:00
Abdelhakim Qbaich
3f1a1b4e9b Macro for FFI with C structs on Gambit 2020-05-01 23:27:45 -04:00
Abdelhakim Qbaich
f049146d46 Correction to setField syntax for Gambit 2020-05-01 23:27:45 -04:00
Abdelhakim Qbaich
4dcef32f53 Directly generate non-ASCII characters for Gambit 2020-05-01 23:27:45 -04:00
Abdelhakim Qbaich
55df14aee7 Specifying a better header for Gambit 2020-05-01 23:27:45 -04:00
Abdelhakim Qbaich
3f1e88814f Vector related fixes for Gambit 2020-05-01 23:27:45 -04:00
Abdelhakim Qbaich
5f3ec8d0a0 Adding a Gambit Scheme backend 2020-05-01 23:27:45 -04:00
Abdelhakim Qbaich
19e78ca3ef Extracting errno for an os-exception in Gambit 2020-05-01 23:27:45 -04:00
Abdelhakim Qbaich
0182c7147a Support library for Gambit Scheme 2020-05-01 23:27:45 -04:00
Abdelhakim Qbaich
1bbf662609 Preparation for the Gambit Scheme backend 2020-05-01 23:27:36 -04:00
Edwin Brady
45d02a11b7 Cache locals after case inspection in evaluator
Without this, we have to recompute them every time they're inspected,
which might be on lots of recursive calls.
Fixes #338
2020-05-01 00:57:47 +01:00
Edwin Brady
4a913752ba Add some more IRs for back ends to use
ANF, in which everything is applied to variables only, and VMCode, in
which everything is reduced to a list of assignments.
I don't plan to add a defunctionalisation step. I've tested with with a
quick hack C backend, though I don't intend to commit that (not here at
least) because even though it basically works, it's Very Slow.
2020-04-30 22:15:04 +01:00
Christian Rasmussen
69aff544b6 Add test of noNewtype 2020-04-29 21:01:33 +02:00
Christian Rasmussen
84e431f495 Add noNewtype option to data types 2020-04-29 21:01:33 +02:00
Matus Tejiscak
b34d275705 Make SortedMap traversable. 2020-04-29 09:10:32 +02:00
Matus Tejiscak
633f51c2f4 Make Traversable (Vect k) public export. 2020-04-29 08:59:00 +02:00
Matus Tejiscak
b53489324e Unify names. 2020-04-29 08:54:37 +02:00