Commit Graph

100 Commits

Author SHA1 Message Date
Justus Matthiesen
0ef1917bf0 [ cleanup ] move calcTerminating to Core.Termination.SizeChange 2023-02-17 14:47:33 +00:00
Guillaume Allais
c6b96080c2 [ refactor ] split up Core.Termination 2023-02-08 16:13:04 +00:00
Zoe Stafford
f9dc56a5f4
[ performance ] String builder on all scheme backends (#2838)
* [ performance ] String builder on all scheme backends
    this makes it about 50x faster at printing scheme code

* [ lint ]

* Add new module

* [ fix ] miscompilation on racket
2023-01-03 11:53:52 +00:00
Stefan Höck
d2c8cf461b
[ performance ] Compile non-recursive top-level constants to constants in Chez (#2817) 2022-12-21 08:48:20 +00:00
Edwin Brady
e125c9014f
Prepare release 0.6.0 (#2733)
* Prepare release 0.6.0

* Fix bootstrap chez

* Correct version in bootstrap chez
2022-10-27 16:32:16 +01:00
Guillaume Allais
e5802204b6 [ fix ] holes in record types 2022-06-17 10:17:40 +01:00
Guillaume Allais
f111838e52 [ cleanup ] move TTC implementations to separate files 2022-06-17 10:17:40 +01:00
G. Allais
d786b5d153
[ IDE ] auto completions (#2511) 2022-06-01 10:26:47 +01:00
G. Allais
071d37197a
[ IDE ] intro command (#2502) 2022-05-27 10:54:34 +01:00
G. Allais
607a2a2110
[ IDE ] refine command (#2490) 2022-05-25 11:29:03 +01:00
G. Allais
4256cd15fd
[ highlighting ] case trees in :di (#2440) 2022-04-29 12:52:23 +01:00
G. Allais
05baf44b5b
[ refactor ] Index Pretty over the type of annotations (#2371) 2022-04-27 12:26:59 +01:00
G. Allais
98b1062772
[ fix ] :printdef support for P(D)Pair & Equal (#2416) 2022-04-15 20:39:46 +01:00
Guillaume Allais
e0f5f541e2 [ fix #2402 ] Check totality before exiting failing block 2022-04-08 13:21:46 +01:00
Guillaume Allais
ad78457869 [ fix ] location information in with clauses 2022-04-01 11:41:48 +01:00
G. Allais
35b2362487
[ new ] failing blocks (#2360) 2022-03-23 12:01:13 +00:00
Zoe Stafford
21d165c31d
[ doc ] Add docs for quotes (#2363) 2022-03-21 19:45:03 +00:00
G. Allais
0dfa7d8d79
[ doc ] prettier :di (#2356) 2022-03-18 08:45:18 +00:00
G. Allais
1c396744d9
[ doc ] :printdef for interface implementations (#2340) 2022-03-07 11:47:20 +00:00
octeep
9a9412e1a2
make writeBufferData return the number of bytes that have been written (#2276) 2022-01-25 13:25:06 +00:00
Ohad Kammar
ade8034bd1
[ refactor ] More IDE protocol (#2238) 2022-01-06 10:09:29 +00:00
Ohad Kammar
3c532ea35d
[ refactor ] IDE protocol as a separate module hierarchy (#2171) 2021-12-16 22:09:00 +00:00
Zoe Stafford
3063218d46
[ new ] Add %nomangle (#2063)
This is (for once) not a breaking changes, instead backends will need to opt in to this change, using the utilities in Compiler.NoMangle. See the js backend for an example of how to do this.

This is the first step to being able to use idris to create libraries usable by other languages.
2021-11-09 16:23:50 +00:00
G. Allais
96c44abb64
[ new ] :doc for keywords (#2028)
* [ new ] :doc for keywords

* [ doc ] for visibility

* [ more ] fixing help text, sentence for "mutual"

* [ doc ] for if then else

* [ doc ] for implicit arguments

* [ doc ] import

* [ cleanup ] doc for data

* [ doc ] for record

* [ doc ] for forall quantifier

* [ doc ] for `in' keyword

* [ doc ] for parameters block

* [ fix ] missing fence

* [ doc ] for where and mutual blocks

* [ doc ] for namespace blocks

* [ doc ] for with/proof

* [ doc ] for do blocks

* [ doc ] for rewrite

* [ doc ] for let binding

* [ doc ] for case...of and interfaces

* [ doc ] for fixity
2021-10-26 18:58:06 +01:00
Guillaume ALLAIS
122b89d7ae [ refactor ] a bit more principled 2021-10-13 13:17:48 +01:00
Stefan Höck
1ebe204c3f
[ refactor ] use proper int types for Constant (#1964)
* [ refactor ] user proper int types for Constant

* [ cleanup ] declare standalone TTC implementations for BitsN/IntN

Rather than doing the casting inline, have the (en/de)coding all
side by side in one place

* [ cleanup ] remove duplicated code

Co-authored-by: Guillaume ALLAIS <guillaume.allais@ens-lyon.org>
2021-10-08 12:07:11 +01:00
Zoe Stafford
d4263441b7
[ new ] Some optimisations mainly involving Nat and Fin (#1817)
Co-authored-by: Guillaume ALLAIS <guillaume.allais@ens-lyon.org>
2021-10-07 19:21:32 +01:00
Mathew Polzin
fa06e9936b
Warn about unreachable default clauses (#1942)
* so much experimentation

* tests that show preliminary evidence the new stuff is working.

* small amount of cleanup

* more cleanup of various troubleshooting code.

* new test case added.

* only log unreachable indices if there are any.

* when traversing deeper simply skip over defaults since they have already been reviewed.

* Remove fallback clause that the changes in this PR correctly identified as unreachable.

* tidying up more.

* move some common functions to a new Core.Case.Util module.

* refer to case builder and case tree under new parent module.

* update imports to look for CaseTree in new submodule.

* update api ipkg

* remove unneeded application operators.

* remove or comment out unreachable default clauses caught by the changes in this PR.

* a bit of code documentation and renaming for clarity.

* bump previous version in CI.

* fix API usage of Util module.

* Add issue 1079 test cases.

* forgot to add new test cases file.

* remove commented-out lines by request of RefC author.

* Use a SortedSet instead of nubbing a list.

* update new case tree import.

* Update src/Core/Case/Util.idr

Co-authored-by: G. Allais <guillaume.allais@ens-lyon.org>

* remove function with nothing to offer above and beyond a differently named copy of the same code.

* replace a large tuple with a record; discover not all of the tuple's fields were needed.

* fix shadowing warning.

Co-authored-by: G. Allais <guillaume.allais@ens-lyon.org>
2021-10-02 12:55:21 +01:00
Edwin Brady
a9ccf4db4f
Experimental Scheme based evaluator (#1956)
This is for compiled evaluation at compile-time, for full normalisation. You can try it by setting the evaluation mode to scheme (that is, :set eval scheme at the REPL). It's certainly an order of magnitude faster than the standard evaluator, based on my playing around with it, although still quite a bit slower than compilation for various reasons, including:

* It has to evaluate under binders, and therefore deal with blocked symbols
* It has to maintain enough information to be able to read back a Term from the evaluated scheme object, which means retaining things like types and other metadata
* We can't do a lot of the optimisations we'd do for runtime evaluation particularly setting things up so we don't need to do arity checking

Also added a new option evaltiming (set with :set evaltiming) to display how long evaluation itself takes, which is handy for checking performance.

I also don't think we should aim to replace the standard evaluator, in general, at least not for a while, because that will involve rewriting a lot of things and working out how to make it work as Call By Name (which is clearly possible, but fiddly).

Still, it's going to be interesting to experiment with it! I think it will be a good idea to use it for elaborator reflection and type providers when we eventually get around to implementing them.

Original commit details:

* Add ability to evaluate open terms via Scheme

Still lots of polish and more formal testing to do here before we can
use it in practice, but you can still use ':scheme <term>' at the REPL
to evaluate an expression by compiling to scheme then reading back the
result.

Also added 'evaltiming' option at the REPL, which, when set, displays
how long normalisaton takes (doesn't count resugaring, just the
normalisation step).

* Add scheme evaluation mode

Different when evaluating everything, vs only evaluating visible things.
We want the latter when type checking, the former at the REPL.

* Bring support.rkt up to date

A couple of missing things required for interfacing with scheme objects

* More Scheme readback machinery

We need these things in the next version so that the next-but-one
version can have a scheme evaluator!

* Add top level interface to scheme based normaliser

Also check it's available - currently chez only - and revert to the
default slow normaliser if it's not.

* Bring Context up to date with changes in main

* Now need Idris 0.5.0 to build

* Add SNF type for scheme values

This will allow us to incrementally evaluate under lambdas, which will
be useful for elaborator reflection and type providers.

* Add Quote for scheme evaluator

So, we can now get a weak head normal form, and evaluate the scope of
a binder when we have an argument to plug in, or just quote back the
whole thing.

* Add new 'scheme' evaluator mode at the REPL

Replacing the temporary 'TmpScheme', this is a better way to try out the
scheme based evaluator

* Fix name generation for new UN format

* Add scheme evaluator support to Racket

* Add another scheme eval test

With metavariables this time

* evaltiming now times execution too

This was handy for finding out the difference between the scheme based
evaluator and compilation. Compilation was something like 20 times
faster in my little test, so that'd be about 4-500 times faster than the
standard evaluator. Ouch!

* Fix whitespace errors

* Error handling when trying to evaluate Scheme
2021-09-24 20:38:55 +01:00
Edwin Brady
1e90182311
Version increment to 0.5.1 (#1939)
This is to remove the requirement on Chez >9.5
2021-09-19 20:53:32 +01:00
Edwin Brady
ada3eb4449
Version 0.5.0 (#1931)
* Update version numbers and bootstrap scheme

* Use wall clock time for search timeouts

That was always the intention in any case, rather than the process time.
2021-09-18 16:07:34 +01:00
G. Allais
32e26c5bd1
[ refactor ] introduce UserName for (UN/RF) (#1926)
Instead of having UN & RF (& Hole in the near future & maybe even
more later e.g. operator names) we have a single UN constructor
that takes a UserName instead of a String.

UserName is (for now)

```idris
data UserName : Type where
  Basic : String -> UserName -- default name constructor       e.g. map
  Field : String -> UserName -- field accessor                 e.g. .fst
  Underscore : UserName      -- no name                        e.g. _
```

This is extracted from the draft PR #1852 which is too big to easily
debug. Once this is working, I can go back to it.
2021-09-15 13:20:58 +01:00
Edwin Brady
9865765d1d
Normalise errors on display, not when they arise (#1906)
* Move Context into its own file

Just the core definition - this is so that we have access to it in
Core.Core, for inclusion in error messages, to save normalisation of
terms in errors until we actually show them.

* Normalise errors on display, not when they arise

This can save a lot of time in ambiguity resolution if the errors are
complicated, because the errors might never be displayed if it's in an
abandoned branch.

This involves lifting 'Context' out of Core.Context, because we need to
store it in Error, which is needed by Core, which in turn is needed in
Core.Context.

Also moved a couple of test caes from ttimp to idris2, so that the
errors get rendered properly and won't need updating unnecessarily. In
fact all of the ttimp tests - which were just part of the initial
scaffolding - are probably now subsumed by the idris2 tests.

* Add new coverage001 test files
2021-09-06 23:37:59 +01:00
Edwin Brady
c3a072c557
Speculative normalisation (#1902)
* Split Normalise into three files

Evaluation, Quoting, and Conversion checking are distinct steps, and I'm
about to add some variations to quoting so better to reorganise a bit.

* Add a Quote mode that limits size of result

Sometimes normalising an expression is a good idea because it makes
things smaler, and sometimes it isnt, because it doesn't. We can't tell
in advance which situation we're in, but we can try speculatively
normalising something. This is good for case types and hole types - we
generally want the normal form, but if that's expensive, we should stop.

So, quote is now able to give up if it passes a certain size threshold
for stuck applications. By experimentation, it seems that up to 10
doesn't hurt too much, but beyond that it's better not to normalise at
all.

* Add the new normalise files
2021-09-05 01:35:21 +01:00
Stefan Höck
031508a790
[ performance ] Common subexpression elimination (#1869)
* [ wip ] common subexpression elimination

* [ performance,js ] lazy initialization

* [ fix ] return filtered usage map

* [ doc ] annotated Compiler.Opts.CSE

* [ doc ] some more code annotations

* [ doc ] fix typo

* [ doc ] of course I had some help

* [ wip ] CSE optimize additional IRs

* [ performance ] allow lazy thunks to be garbage collected

* [ fix ] added GlobalDefs for extracted sub expressions

* [ cleanup ] pass compiled defs around explicitly

* [ cleanup ] dont cse-analyze main expression twice
2021-09-02 06:47:35 +01:00
G. Allais
c1ebc0535d
[ new ] semantic highlighting in REPL & holes (#1836) 2021-08-13 16:00:54 +01:00
Zoe Stafford
1669fc351b
Refactor %builtin (#1803)
* Stub for future 'identity' optimisation
I plan to add this later, but I'm using for now for
NaturalToInteger and IntegerToNatural

* Refactor `%builtin`
fixes #1799

- automatically optimise all Natural shaped things
- NaturalToInteger and IntegerToNatural now use
  new `Identity` flag (internal use only for now)
  which signals the function is identity at runtime

* Use NaturalToInteger and IntegerToNatural for Nat and Fin
Also define show fin in terms of finToInteger, for speed

* Fix name handling for %builtin

* [ tests ] fixes + #1799

* remove %builtin from libs
Add back after next version

* Use resolved names where convenient
2021-08-03 14:19:17 +01:00
Stiopa Koltsov
47205049cf Fork Data.IOArray into the compiler
To be able to modify `Data.IOArray` as proposed in #1677.

Currently `Data.IOArray` cannot be modified because compiler need
to be built with previous compiler. This PR removes compiler
dependency on `Data.IOArray`.
2021-07-15 00:38:08 +01:00
Stefan Höck
599d0635e9
[ refactor ] JS backend overhaul (#1609) 2021-07-10 11:15:21 +01:00
Zoe Stafford
0ecbd517e8
[ improvement ] VMCode (#1662) 2021-07-07 17:06:59 +01:00
Stiopa Koltsov
9c63e90fd2 Write compiler version into generated files 2021-07-06 09:35:48 +01:00
Edwin Brady
00107730ae More version number updates 2021-06-23 18:46:38 +01:00
Robert Wright
a8264f8f05 Add ability to extend RefC backend to create further backends 2021-06-18 16:59:35 +01:00
Stefan Höck
c04835c436
[ cleanup ] Reuse Tarjan's algorithm in JS backend and some other cleanups (#1504) 2021-06-17 12:43:10 +01:00
Fabián Heredia Montiel
a28bc65544
Fix deadlocks [Rebased, Squashed] (#1536)
Co-authored-by: Arnaud Bailly <arnaud.oqube@gmail.com>
Co-authored-by: Guillaume Allais <guillaume.allais@ens-lyon.org>
Co-authored-by: Fabián Heredia Montiel <fabianhjr@protonmail.com>
Co-authored-by: Ruslan Feizerakhmanov <me@russoul.me>
2021-06-15 14:31:31 +01:00
Nick Drozd
4a0a5759b8
Return Maybe from strengthen (#1540)
Co-authored-by: Fabián Heredia Montiel <303897+fabianhjr@users.noreply.github.com>
2021-06-14 10:59:49 +01:00
Fabián Heredia Montiel
0df331690a [cleanup] Remove Libraries.Data.Bool.Extra 2021-06-10 08:29:49 -05:00
Fabián Heredia Montiel
da4ee92530 [ cleanup ] Remove unnecessary Libraries.Utils.Either 2021-05-29 09:30:04 +01:00
Guillaume ALLAIS
ee7956b318 [ cleanup ] move DocString to Doc.String 2021-05-21 18:23:13 +01:00
G. Allais
349308396c
[ fix #621 ] add warnings for shadowed global definition (#1407) 2021-05-14 17:35:21 +01:00