Commit Graph

72 Commits

Author SHA1 Message Date
Neil Brown
e61a23855a Fixed all the conflicts while merging into the Polyplate branch 2009-04-09 11:01:39 +00:00
Neil Brown
1141ecb472 Fixed the Rain modules to use the new Pass system/types 2008-12-14 18:35:39 +00:00
Neil Brown
9260048da2 Quickly fixed the Rain frontend to compile with the operator changes 2009-04-05 23:08:12 +00:00
Neil Brown
e457d82f0c Changed FUNCTIONs and PROCs to have optional bodies, and put all the externals into the AST (without bodies)
This may seem like an odd change, but it simplifies the logic a lot.  I kept having problems with passes not operating on externals (e.g. functions-to-procs, adding array sizes, constant folding in array dimensions) and adding a special case every time to also process the externals was getting silly.

Putting the externals in the AST therefore made sense, but I didn't want to just add dummy bodies as this would cause them to throw up errors (e.g. in the type-checking for functions).  So I turned the bodies into a Maybe type, and that has worked out well.

I also stopped storing the formals in csExternals (since they are now in csNames, and the tree), which streamlined that nicely, and stopped me having to keep them up to date.
2009-04-04 14:56:35 +00:00
Neil Brown
dbc1b461a4 Made makeNonce use the munged meta-tag, to stop wrapper PROCs from different files having name clashes at link-time 2009-04-02 20:02:11 +00:00
Neil Brown
45b22472c3 Changed the rest of tock to reflect the changes to the Is constructor 2009-03-24 23:57:24 +00:00
Neil Brown
78606faaae Reintroduced the transformRangeRep pass, and fixed the transformEachRange pass (along with fixing the relevant tests) 2009-02-03 12:31:54 +00:00
Neil Brown
7d185fd72a Adjusted the Rain passes to cope with the new array literals 2009-02-01 21:54:32 +00:00
Neil Brown
2c6f624ea3 Changed the occam type-checker and the Rain stuff to be okay with the new step count 2009-01-28 23:47:36 +00:00
Neil Brown
0e7a6c5b98 Added a NameSource field for NameDef that indicates where a name comes from 2008-11-25 17:36:42 +00:00
Neil Brown
41ff60cb78 Removed the Rep constructor from Structured and instead added a Rep constructor to SpecType
This way, all replicators are declared like other names, and their scope is considered replicated.  This simplifies the code a little.

Fixes #55
2008-06-04 17:00:43 +00:00
Neil Brown
21329287e2 Fixed a problem with GHC 6.6 and the new pass mechanism by removing all the dollars that were confusing the type-checker 2008-06-03 16:16:26 +00:00
Neil Brown
ba66cce89f Moved all the remaining pass information to be with the passes themselves, and adjusted the tests accordingly
All the passes now have their information (name, pre-requisites and post- properties) stored at the point where the pass is declared, which means the pass lists are just a simple list of pass functions.

The main consequence of this change was that the tests had to be changed.  Now, instead of taking a "pass applied to data" item (type: PassM b), they take both the pass (type: Pass) and source data (type: b), and apply them later.  This was the decision that involved the simplest changes to the existing tests (simply unbracketing the application of the pass to the source).  I also had to include a few old-style versions though (testPass', testPassShouldFail') for where the functions were being used to test things that weren't actually passes (mainly StructureOccam).

Fixes #48
2008-06-02 14:31:19 +00:00
Neil Brown
0adbdda126 Moved all the pass information about the Rain passes into their definition (rather than the pass list at the top)
As part of this patch, I have also introduced a helper function that fiddles the type system for those passes that must run at the top-level (i.e. on A.AST) rather than on any Data t.  They will give an error if not applied at the top-level.
2008-06-02 12:51:14 +00:00
Adam Sampson
13ea7f2c4b Resolve conflicts after merge. 2008-06-02 10:28:26 +00:00
Adam Sampson
36e7353ee7 Take NameType out of NameDef.
NameType is only really needed in the parser, so this takes it out of
NameDef, meaning that later passes defining names no longer need to
set an arbitrary NameType for them. The parser gets slightly more
complicated (because some productions now have to return a SpecType
and a NameType too), but lots of other code gets simpler.

The code that removed free names was the only thing outside the parser
using NameType, and it now makes a more sensible decision based on the
SpecType. Since unscoped names previously didn't have a SpecType at
all, I've added an Unscoped constructor to it and arranged matters
such that unscoped names now get a proper entry in csNames.

Fixes #61.
2008-06-02 10:13:14 +00:00
Adam Sampson
77a718f078 Remove another obsolete comment. 2008-05-30 14:13:24 +00:00
Neil Brown
231d037cb3 Added a pass to turn all List types into Mobile List 2008-06-01 19:26:40 +00:00
Neil Brown
a5fca4816b Added the beginnings of support for implicit mobility for Rain (just printing out the decisions for now) 2008-05-30 17:16:10 +00:00
Adam Sampson
6debf9292f Rework Traversal, and convert all passes to use it.
This changes the Traversal API to the one that I've been working on in
the Polyplate branch, but implemented in terms of Data. The
performance isn't as good as the Polyplate version, but the code is a
lot simpler because it doesn't need all the type constraints (and it
doesn't make GHC struggle).

This also reworks all the passes in Tock to use the new API, including
those that previously used makeGeneric (which I've now removed) or
everywhereM. Most of the passes are simpler because of this, and I
suspect it's fixed a few subtle bugs resulting from missing recursion
in makeGeneric code.

I haven't yet profiled this, but subjectively it seems about the same
as the old Traversal (and thus faster for all the passes that didn't
yet use it).
2008-05-25 20:13:57 +00:00
Neil Brown
d044b51335 Renamed ndType to ndSpecType, as per Trac ticket #59 2008-05-21 13:38:51 +00:00
Neil Brown
9f411bfd45 Fixed the Rain passes so that the order correctly satisfies the pre-requisites 2008-05-21 12:46:51 +00:00
Neil Brown
bd7584e280 Turned off the checkFunction pass for now, since it is over-eager at spotting problems with Rain functions 2008-03-25 18:46:51 +00:00
Neil Brown
6afea19ee6 Cleared up the mess of old stuff in the list of rain passes 2008-05-18 11:36:08 +00:00
Neil Brown
e53fda754e Fixed the Rain passes so the the alphabet test case now works (at least) 2008-05-17 20:51:42 +00:00
Neil Brown
bf07c441ae Changed the communication type checking to be part of the type unification framework 2008-05-17 19:47:47 +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
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
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
8fe152bf98 Merged the type-checking on time-related statements in Rain into the pass that checks types in communications 2008-03-24 15:15:28 +00:00
Neil Brown
cbbafffbd2 Changed Rain to use the new timer type rather than things like the GetTime statement 2008-03-24 13:50:14 +00:00
Neil Brown
c68aa42277 Added a sub-type to Timers, to support multiple types 2008-03-23 22:20:16 +00:00
Neil Brown
c1479bc1a8 Fixed the list of excluded Rain things by removing IntrinsicFunctionCall from the list 2008-03-23 11:48:33 +00:00
Neil Brown
dd7b0268b2 Added a new property (functionTypesChecked) to help fix the pass ordering 2008-03-23 00:09:01 +00:00
Neil Brown
230db2de08 Added support for specifications at the start of functions without ruining the check for a return statement 2008-03-22 18:57:23 +00:00
Neil Brown
ae142a94e1 Added support for uniquifying function arguments to the Rain passes 2008-03-22 18:34:07 +00:00
Neil Brown
33b04e7646 Tidied up a few unused functions and module imports 2008-03-21 15:16:36 +00:00
Neil Brown
0dc458ff03 Fixed transformEachRange to change the abbreviation mode of the loop counter 2008-03-21 15:09:00 +00:00
Neil Brown
dfea2c11a5 Added a dummy Rain pass to supply the new retypesChecked property 2008-03-21 15:07:56 +00:00
Neil Brown
50ce3410b8 Added the pass for giving lists a type to the pass list 2008-03-20 16:54:40 +00:00
Neil Brown
af4a66e2e4 Corrected the spelling of the name of one of the Rain passes 2008-03-20 16:46:45 +00:00
Neil Brown
8f51ead090 Rewrote transformRangeRep, stopping it requiring constants in ranges 2008-03-20 12:40:07 +00:00
Neil Brown
ad7a76dace Altered transformEachRange to make it more straight-forward 2008-03-20 09:36:26 +00:00
Neil Brown
43b77ff1a0 Made names for loop variables unique in Rain, and made their abbreviation mode Abbrev 2008-03-19 17:19:58 +00:00
Neil Brown
6b04b6d944 Added a pass to pull up expressions in for-each loops into a variable 2008-03-19 17:18:56 +00:00
Neil Brown
db0467f1ca Adjusted the rain passes to use the new array constructor type, and weaned a few of them off everywhereM 2008-03-19 13:24:15 +00:00
Adam Sampson
79eefd5e98 Move constant checking from the occam parser into a pass.
The parser now doesn't do any constant folding or checking.
2008-03-19 12:47:29 +00:00
Neil Brown
5c43172e46 Added an annotation to array subscripts to indicate whether they should have a run-time check added or not 2008-03-09 14:30:19 +00:00
Neil Brown
ba75f5b06c Removed the initialiser expression on the Declaration item in the AST 2008-03-09 00:23:13 +00:00
Neil Brown
7af49a2d10 Fixed the checkFunction pass 2008-02-25 21:27:37 +00:00