Commit Graph

1761 Commits

Author SHA1 Message Date
Neil Brown
cbe460f306 Added a new part to UsageLabel for conditions in nodes, and added a new corresponding labelling function for nodes 2008-06-06 18:32:47 +00:00
Neil Brown
fe1238d379 Added a helper operator to make the FlowGraph module a bit more readable 2008-06-06 18:23:03 +00:00
Neil Brown
d3c9d90f8d Corrected a bug when wiring up specifications (specifically inside ALTs) in the flow graph 2008-06-06 16:06:03 +00:00
Neil Brown
4c5067e8b1 Fixed some Rain tests broken by recent changes 2008-06-06 10:49:29 +00:00
Neil Brown
5ef075e5d2 Added background knowledge based on replicator bounds 2008-06-06 10:45:46 +00:00
Neil Brown
7538fcc225 Reindented some code in ArrayUsageCheck (just tidying up) 2008-06-06 10:44:05 +00:00
Neil Brown
b603b43b57 Added a subOne function (the dual of addOne) to the Types module 2008-06-06 10:43:30 +00:00
Neil Brown
cb6fb40440 Added some more testcases involving deduction from (sequential) replicator bounds 2008-06-06 10:39:12 +00:00
Neil Brown
b9b025a429 Added some tests for the new usage checking and reachability mechanisms 2008-06-05 23:11:00 +00:00
Neil Brown
78a513a852 Implemented addBK, at least for assignments 2008-06-05 23:10:30 +00:00
Neil Brown
d75bca3c0d Added a couple of new helper functions to the Utils module 2008-06-05 23:09:46 +00:00
Neil Brown
ca8c6f14ce Cleaned up some code in ArrayUsageCheck that is uncommented when bugs appear 2008-06-05 23:09:01 +00:00
Neil Brown
c9da4a7eaf Overhauled the way that the array usage checking deals with background knowledge, ready to implement usage checking that makes proper use of background knowledge (information from elsewhere in the program) 2008-06-05 20:37:59 +00:00
Neil Brown
cf35eb97d3 Corrected a couple of uses of flowAlgorithm to use the connected nodes, not all the remaining nodes in the graph 2008-06-05 20:35:43 +00:00
Neil Brown
7e0bc775bf Changed the writtenVars entry of Vars to be a map from variables to (assigned-from) expressions
The expressions are optional (wrapped in a Maybe type)
2008-06-05 20:30:44 +00:00
Neil Brown
d9e8c7fc87 Changed findReachDef to return a map from nodes to expressions rather than previous nodes
The expressions are optional (wrapped in a Maybe type).  Nothing indicates that the variable was written to, but that the value isn't available.  This is usually the case (for example, process parameters, channel inputs).

I have also temporarily disabled the tests for this function
2008-06-05 20:30:06 +00:00
Neil Brown
17255bb2b1 Changed the uses of flowAlgorithm to make better use of userErrLabel to give better error messages 2008-06-05 20:22:47 +00:00
Neil Brown
24b10deb33 Realised that ParItems is a functor, and therefore made it an instance of such 2008-06-05 20:17:25 +00:00
Neil Brown
936382a3ca Renamed labelFunctions to labelUsageFunctions, to make it clearer what the functions are for 2008-06-05 20:16:02 +00:00
Neil Brown
ac3d1ed42a Reordered the type parameters for the FNode' type in the flow graph, and made it a functor over the label 2008-06-05 20:11:13 +00:00
Neil Brown
64e86b22fe Fixed some StructureOccam tests that were broken recently by the change in the Token type 2008-06-06 13:14:34 +00:00
Adam Sampson
ab416326ad Make Token a real data type.
Previously it was a tuple, which meant it couldn't have sensible
custom instances. Token and TokenType now have Show instances, so we
get more useful output when parsing fails.
2008-06-05 09:46:52 +00:00
Neil Brown
069cfd9a9f Fixed the pulling up of replicators when they are free names (something that was broken in the original Rep change) 2008-06-04 19:06:05 +00:00
Neil Brown
e2dac3aa76 Simplified freeNamesIn by removing what is an unnecessary case for replicators 2008-06-04 19:05:31 +00:00
Neil Brown
cfbdfc555e Fixed a discrepancy between the C and C++ backends over generating the code for replicators 2008-06-04 18:53:42 +00:00
Neil Brown
4c726352a4 Removed an obsolete failing Rain test 2008-06-04 18:44:07 +00:00
Neil Brown
5bc88ec1fc Fixed another test that was broken during the change to Rep 2008-06-04 18:43:50 +00:00
Neil Brown
a417708cda Fixed some of the flow graph tests that were broken by the change to Rep 2008-06-04 18:32:16 +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
9066d4112b Removed all the PassR and PassMR stuff, now we just have Pass and PassM 2008-06-03 16:30:10 +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
Adam Sampson
f2352019ab Implement INITIAL and RESULT abbreviations.
This adds the passes to transform INITIAL into the correct form.

Fixes #42.
2008-06-03 14:57:24 +00:00
Adam Sampson
6ee21f76c9 Initial work on supporting INITIAL and RESULT abbreviations.
This fixes the AST, parser and typechecker, and adds a pass to
transform Result back into Abbrev, but doesn't transform Initial yet.
(It actually works for trivial stuff anyway, but it won't do the right
thing for complex types or PROC parameters.)

It appears (to me) to make sense to support INITIAL/RESULT reshaping
and retyping too, so this does.

Refs #42.
2008-06-02 20:41:37 +00:00
Adam Sampson
f811d2cdc9 Clean up some remaining messy code after the passes rework. 2008-06-02 17:04:30 +00:00
Adam Sampson
13668f6e32 Change the property-checking code to use Neil's new pass structure. 2008-06-02 17:03:41 +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
6f6538ed57 Added more helper functions to the Pass module for constructing passes 2008-06-02 14:21:56 +00:00
Neil Brown
59e0922263 Added a new operator to Utils (>.>, the flipped version of <.<) 2008-06-02 14:09:33 +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
3e56aa0671 Reenable the --sanity-check option.
The code now adds extra passes to check that properties hold when sanity
checking is enabled.
2008-06-02 14:55:56 +00:00
Adam Sampson
cf79f9c284 Get rid of the nasty ghost names hack.
Rather than prefixing the names, there's now a set of ghost names in
CompState.

Fixes #66.
2008-06-02 10:58:26 +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
Adam Sampson
9749d58f09 Remove an obsolete comment. 2008-05-30 12:24:46 +00:00
Neil Brown
104bdf5d0a Fixed genBytesIn for mobile and list types in the C backend 2008-06-01 19:50:53 +00:00
Neil Brown
4e6b166696 Fixed implicit mobility to work in the (C++, at least) backend 2008-06-01 19:46:32 +00:00
Neil Brown
5301b83148 Added code to actually make the implicit mobility decisions take effect in the tree 2008-06-01 19:28:22 +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
e66ce1f810 Added a line to ShowCode for dereferenced variables 2008-06-01 19:25:33 +00:00