Commit Graph

980 Commits

Author SHA1 Message Date
Edwin Brady
8a0063a016
Merge pull request #280 from gallais/comments
[ fix #279 ] comment delimiters with more than one dash
2020-04-21 10:49:24 +01:00
Edwin Brady
69e774bd00 Merge branch 'jeetu7-master' 2020-04-21 10:48:11 +01:00
Edwin Brady
9930b64c1c Merge branch 'master' of https://github.com/jeetu7/Idris2 into jeetu7-master 2020-04-21 10:47:38 +01:00
Edwin Brady
ac277ce6d0 Erase the World, with care
We can erase things of type %World, which opens up more possibilities of
newtype and helps optimise IO, but we need to be sure that the side
effecting operations aren't optimised away as a result because we no
longer have to inspect the newtype. Therefore, if optimising away a case
analysis on a newtype with a %World deleted, add a let binding for the
scrutinee of the case, and flag it as non-inlinable.
2020-04-21 10:47:19 +01:00
Edwin Brady
5ea11cf0f5
Merge pull request #282 from abailly/network-binary
provide building blocks for binary network I/O
2020-04-21 10:45:52 +01:00
Edwin Brady
d3d5e22011
Merge pull request #274 from ska80/tutorial/typos
Fix some typos in the tutorial
2020-04-21 10:39:53 +01:00
Edwin Brady
4b65d8d6fc
Merge pull request #273 from jfdm/badges
Added a travis badge because it's good to have badges...
2020-04-21 10:39:09 +01:00
Edwin Brady
7cd9964d4f Comment correction
The comments don't get type checked, but this was rather important :).
2020-04-19 23:45:30 +01:00
Edwin Brady
f6bbfb3dee Remove costly 'swapBlocks' in lambda lifter
No need if we separate the context into arguments from the outer scope,
and arguments from the current scope. Needs care to compile correctly,
though.
2020-04-19 23:42:13 +01:00
Edwin Brady
1734841275 Add a lambda lifter
It's not actually used as part of any compilation pipeline yet, and I've
only tested it by eyeballing the output, but it'll be useful soon, and
it's good for it to be available to any new back ends that might need
it. It will need some optimisation.
2020-04-19 22:57:10 +01:00
Edwin Brady
8fccd5f2a3 Properly erase constructor arguments
That is, really erase the argument position rather than just putting
'erased there. It doesn't make a huge difference to the generated scheme
performance, but since we can always do this for constructors, we might
as well.
2020-04-19 19:43:51 +01:00
Edwin Brady
44c01f83d2 Move outermost lambdas to top level
This improves runtime performance a bit since it avoids creating some
unnecessary closures (and is a preliminary step to lambda lifting, which
might help for some back ends).
2020-04-19 16:49:25 +01:00
Edwin Brady
884d4adad2 Fix buffer allocation error
Not calculating the needed space correctly, so sometimes not expanding
the buffer enough! This cause buffer data to be corrupted, leading to
issues like #114.
2020-04-16 22:17:01 +01:00
Edwin Brady
9bc72a79c0 Need 'begin' around putstr primitive
This only becomes necessary after inlining, but Scheme needs to
understand it as one argument.
2020-04-16 13:59:23 +01:00
Edwin Brady
40980786e1 Ignoring the World is inadvisable
If IO operations don't return an updated world token, the inliner might
think they're not used at all. So if this turns out to be an overhead,
we'll have to work out another way of eliding it.
2020-04-16 13:39:55 +01:00
Kamil Shakirov
dfc7001bfc Ditto 2020-04-16 18:23:13 +06:00
Edwin Brady
b665e6afbf Another small inlining improvement
Remove unused lets, and batch resolution of de Bruijn indices in case
branches
2020-04-15 23:59:54 +01:00
Edwin Brady
048bce23a6 Make inlining faster with One Weird Trick
Or, more accurately, by not doing a thing that's a waste of time. After
evaluating a local, if the result isn't applied to a stack, there's no
more reduction to do, so stop there.

Still go to the explicit named representation afterwards, since that's
an easier API for a code generator, and by then the names are guaranteed
unique.
2020-04-15 21:46:28 +01:00
Edwin Brady
d5bfb8f136 Use explicit named representation for compiling
Apologies to anyone who's working on a back end independently!

You can still use CExp for now, but I'm shortly going to try using
NamedCExp in inlining, to save the fairly large cost of maintaining the
de Bruijn indices when going under binders.

Names are kept unique in the translation, so you can assume you don't
need to worry about them.
2020-04-15 11:14:02 +01:00
Arnaud Bailly
2b0cc2a592 provide building blocks for binary network I/O 2020-04-14 21:15:32 +02:00
Edwin Brady
843619790e Another small improvement in code generation
Use a variant of MkVar which has the name in the type and therefore
means it can be erased to a newtype, so just an Integer. Then use
'insertNames' rather than repeatedly thinning.
2020-04-14 20:03:35 +01:00
Guillaume Allais
f10edd51f5 [ fix #279 ] comment delimiters with more than one dash 2020-04-14 14:13:38 +01:00
Kamil Shakirov
d258584a9f Ditto 2020-04-14 18:28:06 +06:00
Edwin Brady
849a1da846 Erasure correctness
A bit of reorganisation to ensure that the context membership proofs are
erased. It's only a small overhead in general to keep the proofs, but
there are places where it's really noticeable, particularly when
compiling large programs.
2020-04-14 13:13:59 +01:00
Jeetu
9a9101ab0f Merge https://github.com/edwinb/Idris2 into sync
Updating latest code from edwinb repo.
2020-04-13 17:53:28 +05:30
Jeetu
00fc9a603d Refactored the docs directory for latest sphinx_rtd_theme.
Source and build directory are seperate.
References and footnotes are named.
Other than that, tried to do no changes in the docs.
Fixed multi label in proofs-index.
Fixed most of the warnings in make html.
HTML and PDF are building.
2020-04-13 17:45:52 +05:30
Jeetu
5175743e78 Removed docs directory for adding new docs. 2020-04-13 17:41:59 +05:30
Jeetu
db25e81d48 Mostly references naming. Still footnotes are not coming on the same line as its number. 2020-04-13 16:40:23 +05:30
Edwin Brady
806e8d2569 Faster inlining phase of compiler
It's still too slow, but better than it was. Instead of all the
weakening, invent a new name when evaluating under a lambda and
substitute later.
Possibly we can improve this later by substituting in batches, like the
main evaluator does.
2020-04-12 22:37:11 +01:00
Edwin Brady
0ed9f6cee6 Occasional performance boost
Check for conversion without reducing names, before unifying arguments.
This is quick to check, and can save a lot of evaluation.
2020-04-12 18:01:45 +01:00
Edwin Brady
841c3f27a5 Change order of argument search in auto implicits
For consistency with interactive expression search
2020-04-10 15:39:45 +01:00
Edwin Brady
69a7640a6e Allow flagging types as externally defined
e.g. in a C file. This means we don't accidentally treat things as
empty, since previously we just defined these as empty types, but that
broke coverage checking. Fixes #240
2020-04-10 11:45:52 +01:00
Jeetu
a24511eae2 Spelling mistake corrected. 2020-04-10 16:14:54 +05:30
Jeetu
a9ac084b8c Added instruction for virtual environment for python. 2020-04-10 13:34:03 +05:30
Edwin Brady
0daece1e0e Fix where under multiple cases
The names the locals were being applied to weren't being updated
properly, so applications of local functions inside case blocks were
sometimes given the wrong arguments. This is one of the few places where
it's hard to keep track of names in the type system! So naturally that'd
be where things go wrong I suppose...
2020-04-09 18:47:39 +01:00
Edwin Brady
6e02ffcb28 Local definitions need to be namespaced
It's unlikely, but possible, that there will be a clash otherwise since
the resolved names aren't unique between modules.
2020-04-09 14:06:53 +01:00
Kamil Shakirov
0ea595817a Fix some typos in the tutorial 2020-04-09 13:48:12 +06:00
Edwin Brady
211fc359ca Erase %World for the purpose of newtypes
We never inspect it, so it carries no information - it just needs to be
there as a token to make sure that IO operations run at the right time.
So, IORes can be a newtype now and therefore optimised away.
2020-04-09 00:20:37 +01:00
Edwin Brady
471a47255f newtype optimisation
Data types with one constructor, that has one unerased argument, are
translated to that argument for runtime. This doesn't have a huge effect
on its own, but doing this will expose other optimisations later (e.g.
increasing effect of inlining).
2020-04-08 19:34:37 +01:00
Edwin Brady
1b859fa5b3 Complete specialised definitions
Specialisation happens on the run time case tree, so we need to know
separately which names occur at compile time, and which at run time.
Hence, we now have 'refersToRuntime' in addition to 'refersTo' since
they will be different. (In fact there's more differences, because
there's a lot of metavariable names which are needed at compile time but
erased at run time)
2020-04-07 15:05:06 +01:00
Jan de Muijnck-Hughes
9ad7efd483 Added a travis badge because it's good to have badges... 2020-04-07 13:26:27 +01:00
Edwin Brady
620172b430 Remove superfluous line 2020-04-06 22:40:21 +01:00
Edwin Brady
2688f070e5 Add an ipkg for Idris2 as a library
This is step 0 towards pluggable back ends
2020-04-06 22:27:31 +01:00
Edwin Brady
d801d0d9ae Start on specialisation
This identifies calls that need specialising and builds a type, but
there's still work to do to build the specialised function.
2020-04-06 22:27:31 +01:00
Edwin Brady
2a81bd9fc3 Syntax for flagging arguments to specialise
We'll use this for specialising interfaces in particular, and eventually
for more partial evaluation. (Semantics not yet implemented)
2020-04-06 22:27:31 +01:00
Edwin Brady
1c4b558b26
Merge pull request #271 from ohad/bugfix-269
Bugfix #269
2020-04-06 22:27:19 +01:00
Edwin Brady
3b07afc601
Merge pull request #268 from gallais/interactive-test
[ new ] interactive test runner
2020-04-06 22:12:15 +01:00
Edwin Brady
e383c2793d
Merge pull request #265 from then0rTh/patch-1
fix typo in docs/tutorial/typesfuns.rst
2020-04-06 22:02:40 +01:00
Edwin Brady
36897138db
Merge pull request #261 from gallais/resugar
Resugar `Nat` literals
2020-04-06 21:58:14 +01:00
Edwin Brady
8beeb6ee5a
Merge pull request #260 from ska80/tutorial/idris-prompt
Update Idris prompt in the tutorial
2020-04-06 21:56:27 +01:00