Commit Graph

2343 Commits

Author SHA1 Message Date
Neil Brown
abbca5f235 Added tests for channel communications (and type unification) 2008-05-17 19:43:44 +00:00
Neil Brown
ddb9ba2fd3 Corrected a bug in unifyArgs where errors that occur while processing arguments were being ignored 2008-05-17 19:42:49 +00:00
Neil Brown
e72e537c47 Added a missing line in the Makefile for UnifyType 2008-05-17 16:55:04 +00:00
Neil Brown
ab0301a342 Made the Rain parser actually record an unknown (to-be-inferred) type for numeric literals 2008-05-17 14:24:45 +00:00
Neil Brown
cd0c8d2901 Added assignments to the new type unification system for Rain 2008-05-17 14:23:31 +00:00
Neil Brown
1e6ae6bff9 Improved the error messages when the type unification fails 2008-05-17 14:23:00 +00:00
Neil Brown
f10cb7d525 Moved the TypeExp type out to its own module, UnifyType 2008-05-17 14:21:57 +00:00
Neil Brown
0aeebfeeb8 Added more tests for the Rain type system, this time assignment 2008-05-17 14:19:50 +00:00
Neil Brown
3249381995 Added a Rain test file for the type checker 2008-05-17 13:17:12 +00:00
Neil Brown
7d65db43c0 Changed TestHarness to support Rain test files as well as occam 2008-05-17 13:13:52 +00:00
Neil Brown
63a28d0044 Changed the conditionals type-checking to use type unification rather than the old system 2008-05-17 12:53:05 +00:00
Neil Brown
f8b7e8f8cb Added unifying-related items to CompState, and changed all the uses of ST to IO in the TypeUnification module
As part of this patch I also had to provide a Data instance for TypeExp (to allow CompState to still be an instance of Data).  Using IORefs is easier than STRef RealWorld, and puts everything in terms of IO (which is already in PassM) rather than ST (which would require more lifting).
2008-05-17 12:50:52 +00:00
Neil Brown
e6162877af Changed the AST to fix the different unknown/inferred types
The Infer type (used by the occam frontend) is now separated from the "Unknown" types used in type unification that I'm experimenting with in Rain.
2008-05-17 12:47:31 +00:00
Neil Brown
e72e95625a Added a checkDepthM2 function to the Traversal module 2008-05-17 12:44:55 +00:00
Neil Brown
875cf4b40a Provided slightly better error messages from the type unification module 2008-05-14 12:18:58 +00:00
Neil Brown
e843ce5022 Added a mapMapWithKeyM function to Utils, and cleaned up some of the whitespace 2008-05-14 12:18:27 +00:00
Neil Brown
e3bf321f33 Made the key type in the type unification generic (as long as it provides Ord and Show) 2008-05-14 12:06:11 +00:00
Neil Brown
e09fb2b9ec Added support for numeric literals in the type inference algorithm 2008-05-14 12:01:32 +00:00
Neil Brown
962c1477b9 Added a special type for marking the type of numeric literals to be inferred later 2008-05-14 11:59:33 +00:00
Neil Brown
ed9c92878a Added a helper function to RainTypesTest to make the unification tests shorter 2008-05-14 10:09:42 +00:00
Neil Brown
9f1d65f4a0 Added more tests for type unification, fixed some bugs and added cleaner error handling 2008-05-14 09:52:16 +00:00
Neil Brown
e3fa3df623 Added a module for doing type unification, and some very basic tests for it 2008-05-13 23:25:42 +00:00
Neil Brown
3ca4ee1a5e Added a new helper function to Utils for transforming Map values monadically 2008-05-13 23:24:43 +00:00
Neil Brown
89c25e3f6c Added a type-class for retrieving the (AST) type of things
This patch hides all the old typeOfExpression, typeOfName, typeOfVariable, etc, and unifies them into a single type-class with an "astTypeOf" function.  The type-class is currently named Typed, but that can easily be changed (it's only explicitly referred to in the Types module).  The patch is essentially the type-class with a giant find-and-replace on the other modules.
2008-05-17 11:41:52 +00:00
Neil Brown
3daf82d318 Merged Alternative and AlternativeCond into a single Alternative item that always has a pre-condition 2008-04-03 14:52:37 +00:00
Adam Sampson
04da66531f Fix nesting.occ so it has a valid TLP signature. 2008-05-15 12:23:44 +00:00
Adam Sampson
0106e6bbb7 Fix the page size in the Tock logo.
This makes it render properly in things other than Inkscape; previously the
logo was drawn outside the page area.
2008-05-14 23:22:50 +00:00
Adam Sampson
7a7e3e2b24 Make GenNavAST generate instances of a "Polyplate" class.
This provides transformM, which we can build applyX (etc.) on top of:
it takes a set of functions, and applies them wherever they could
match in a data structure, without automatically recursing. This is
done using a four(!)-argument typeclass, drawing inspiration from
Biplate.

The resulting 25,000-line set of instances takes a little while to
compile...
2008-05-10 16:27:46 +00:00
Adam Sampson
058a3488d9 Generate instances of a Navigable class.
This isn't immediately useful, but I plan to build on it.
2008-05-09 15:46:18 +00:00
Adam Sampson
710be039cb Have the pregen programs figure out the types using generics.
Previously they had a list of the types they needed to generate
instances for.  This patch adds some helper code that can be used to
list all the AST.* types in the AST automatically. The result is that we
should be able to add new types to the AST without needing to change the
generator code.

This also means that GenOrdAST is now generating *all* the instances of
Ord for the AST; previously the trivial ones were derived by the
compiler.
2008-05-09 14:02:13 +00:00
Adam Sampson
9f172865ff Move DataBox into Utils.
AnyDataItem is effectively the same, so we could reuse DataBox for that
too in the future.
2008-05-09 09:50:42 +00:00
Adam Sampson
9c77aed7b3 Move Gen* into their own directory. 2008-05-09 09:36:45 +00:00
Adam Sampson
8babfb2911 Remove profiling options added by mistake. 2008-05-09 09:36:29 +00:00
Adam Sampson
06296276a4 Use unlines in GenOrdAST too. 2008-05-08 20:45:48 +00:00
Adam Sampson
8b991806e7 Clean up GenTagAST so that it just has one list of types.
This meant having it figure out which types are parameterised and
what their prefixes should be automatically. (More work for Typeable.)
2008-05-08 16:07:46 +00:00
Adam Sampson
0e2a944788 Make GenOrdAST and GenTagAST use Typeable.
This simplifies the code quite a bit, since Typeable knows about
parameters to types; you don't have to do magic to handle
Structured Thingy any more.
2008-05-08 15:37:56 +00:00
Adam Sampson
2d00b1e5c5 Optimise applyX a bit.
This avoids computing the transformation function each time we recurse.
2008-05-07 15:51:09 +00:00
Adam Sampson
0886ab9f9b Abstract the set of types that gmapMFor takes out to a type.
(No change in behaviour, yet.)
2008-04-08 23:13:58 +00:00
Adam Sampson
441b2ee344 Do away with the pkgconfig file in favour of another generated module.
Paths.hs is now generated by the Makefile.am, so it can include paths.

As a bonus, this actually works, since we weren't previously installing the .pc
file anywhere...
2008-05-07 13:06:27 +00:00
Adam Sampson
7567e5e499 Move the autoconf-generated Haskell files into a "config" directory. 2008-05-07 12:57:35 +00:00
Adam Sampson
39c7522096 Remove an obsolete FIXME. 2008-05-07 12:49:20 +00:00
Adam Sampson
d289900cb5 Use pkgconfig to find CCSP.
This means we now only depend on CCSP, rather than all of KRoC.
2008-05-07 10:48:48 +00:00
Adam Sampson
f3ca84c2b9 Add AC_PREREQ.
We need a fairly recent autoconf; this'll make it obvious if a user's got an
older one.
2008-04-26 19:58:52 +00:00
Adam Sampson
298c71ad8f Add a logo for Tock. 2008-04-18 10:17:32 +00:00
Adam Sampson
474e805c75 Add a "run" target to build and run the cgtests.
This uses the run-tests script.
2008-04-08 15:17:40 +00:00
Adam Sampson
8625859773 Flush output when the C backend exits.
This makes "someprog | cat" work -- previously the output never got written.
The C++ support code already does this.
2008-04-08 15:12:24 +00:00
Adam Sampson
f445ccbdc9 Fix C style.
The Tock support headers (at least the C side) follow the KRoC C standards,
which are essentially K&R with spaces before function arg lists.
2008-04-08 15:08:25 +00:00
Adam Sampson
ce622da2cb Use rm -f. 2008-04-08 14:54:00 +00:00
Adam Sampson
3da2ad1385 Provide combinators for generic traversals.
The types get hairier, but the code is much simpler!

I've left {check,apply}DepthM{,2} there for now, but reimplemented them in
terms of the new combinators.

Fixes #58.
2008-04-08 14:41:25 +00:00
Adam Sampson
e460032c30 Remove debugging putStr from the QC-HUnit adaptor.
This was what was causing random numbers to appear during testing.

I've also cleaned up the code a bit.
2008-04-08 14:39:43 +00:00