Neil Brown
377233b4b0
Switched checkUnusedVar over to use forAnyASTStruct
2008-11-13 20:12:45 +00:00
Neil Brown
16a2be40b4
Made the doTree and similar functions more polymorphic, and added forAnyASTStruct
2008-11-13 20:10:43 +00:00
Neil Brown
048bd26be3
Moved the holding of the route out from RestartT (which now just deals with restarting) and into CheckOptM' (which was previously a fairly needless wrapper)
2008-11-13 19:59:41 +00:00
Neil Brown
594cb6faf3
Changed from giving a full Route as the restart point to just the identifier, since that's all we were using anyway
2008-11-13 19:16:26 +00:00
Neil Brown
6f5c007f18
Fixed the problem, which was that I didn't really want a continuation for restarting, I just wanted to apply the original function at the same point, so I'd been needlessly complicating things
2008-11-13 18:28:47 +00:00
Neil Brown
046ac4a75b
Added a testcase (triple directly nested unused vars) that is failing, presumably due to not restarting the search at the right point
2008-11-13 18:08:36 +00:00
Neil Brown
265181d3c3
Moved all of the sub-functions of forAnyAST to the top-level
2008-11-13 16:43:01 +00:00
Neil Brown
6fc4ac9550
Added a warning when we removed an unused variable
2008-11-13 15:37:02 +00:00
Neil Brown
0d486f108f
Added a value to indicate what type a warning is (to support future configurability) and streamlined the warning functions
2008-11-13 15:36:22 +00:00
Neil Brown
95f6ef2889
Slightly refactored (and commented) the checks framework
2008-11-13 14:55:55 +00:00
Neil Brown
cd41124003
Added another test for unused variables
2008-11-13 14:55:37 +00:00
Neil Brown
713011534f
Corrected the nodes searched during the flow analysis
...
I was searching starting at the current node, but I actually should have started at the terminal node connected to the current node as I need to process all the nodes ahead of me -- but in a backwards flow
2008-11-13 13:02:46 +00:00
Neil Brown
1cf9dfff0e
Implemented getDecl, although it returns a name for all specifications (including typedefs and processes)
2008-11-13 13:02:09 +00:00
Neil Brown
2673ace2d5
Changed the lambda in checkUnusedVar to be an inner function, now that I've removed my code that used to ignore pattern-match failures
2008-11-13 13:01:22 +00:00
Neil Brown
01caa4d9f5
Improved the cached analysis stuff to work with nodes better, allowing the programmer to specify a test for the node label so that the right node is picked based on the route identifier
2008-11-12 18:51:05 +00:00
Neil Brown
44e2699089
Improved the Show instance for UsageLabel
2008-11-12 18:50:25 +00:00
Neil Brown
2a15f4ef5f
Filled in all the gaps such that the CheckTest tests now run (including some debug output, for now)
...
One of the tests fails at the moment because the specification node has two entries associated with it in the flowgraph. One is the scope-in and one is the scope-out. I think the analysis is currently picking the scope-out node and looking beyond that, where -- surprise, surprise -- the variable is not used again. So I need some easy way of telling the flow analyses which of the two nodes I want to start from, in this case and other ones where I also add two nodes related to the same point in the AST.
2008-11-12 16:54:00 +00:00
Neil Brown
76cfb4d8f5
Added route-identifiers for blank AST modifiers in the flow graph
2008-11-12 16:47:15 +00:00
Neil Brown
4d10930f78
Corrected a test (Only is not valid at the top-level of an AST)
2008-11-12 15:56:19 +00:00
Neil Brown
98122211ad
Got all the new analysis stuff compiling, but with several parts unimplemented
2008-11-12 12:34:32 +00:00
Neil Brown
8f691c057e
Fixed one of the tests that had the actual and expected reversed
2008-11-12 12:33:46 +00:00
Neil Brown
3a6b432c77
Recording some information about my failed attempts to fiddle with the GHC flags
2008-11-10 16:46:38 +00:00
Neil Brown
3d576b7ff3
Removed my pattern-match magic before I start relying on it, since it is probably a hack too far
2008-11-10 15:58:58 +00:00
Neil Brown
dc030acabe
Changed the FlowGraph stuff to use the new Route type (that includes identifiers) rather than the bare functions as it used to
2008-11-10 14:01:30 +00:00
Neil Brown
8405c646e3
Added a file for testcases for checks that use the new framework
2008-11-10 13:08:14 +00:00
Neil Brown
99ddca4a0f
Added a function to execute the CheckOptM monad on an AST
2008-11-08 16:01:08 +00:00
Neil Brown
a764031068
Added the support for glossing over pattern-match failures
2008-11-08 16:00:29 +00:00
Neil Brown
a4c2196f3c
Removed the ErrorT now that we are on top of PassM anyway
2008-11-08 15:59:40 +00:00
Neil Brown
893fd542d6
Tidied up and comment some of the checking framework
2008-11-08 12:58:57 +00:00
Neil Brown
e2cd70bf30
Implemented the substitute and restart methods
2008-11-08 12:29:50 +00:00
Neil Brown
f9d6a9aa8d
Added the new module to the Makefile (forgot to do so in the last patch)
2008-11-08 12:02:13 +00:00
Neil Brown
d0e2cd7b03
Finally wrestled the Haskell typechecker into submission to add my CheckFramework and its monads, which will hopefully do all that I need
2008-11-08 00:00:09 +00:00
Neil Brown
d6b102838a
Added a Route data type that packages up the routing function and an identifier (to provide equality)
2008-11-07 10:08:16 +00:00
Neil Brown
d12b2178de
Added an augmented version of Adam's gmapMFor that uses the same generics techniques, but also gives a route to the node to the transformation function
2008-11-06 18:32:35 +00:00
Neil Brown
31091a5795
Moved the ExSet type (used for the checks) out to its own module
2008-11-05 21:40:24 +00:00
Adam Sampson
16fee9c9eb
Add the Tock hacker's guide to the repository.
...
This used to be in a CSProjects Subversion repo, but I figure if we keep it
with the code it's more likely to stay up-to-date.
2008-11-20 13:41:06 +00:00
Neil Brown
bcad0c225f
Converted the other pullRepCounts test over to the new system
2008-11-16 19:40:27 +00:00
Neil Brown
fe3dd78db3
Realised that pullRepCounts should pull the counts for PAR and ALT after all, and adjusted one test to reflect this
2008-11-16 18:43:34 +00:00
Neil Brown
bfacb526fb
Converted one of the tests for pullRepCounts to use the new mechanism, which in turn exposed that the pass was not altering the definition in the state (which it may as well)
2008-11-16 18:25:53 +00:00
Neil Brown
771297632d
Finished converting all the cases in testInputCase to use the new occam EDSL
2008-11-16 16:57:52 +00:00
Neil Brown
9ac861ac93
Fixed the map ordering problem by matching against any permutation
2008-11-16 13:06:08 +00:00
Neil Brown
b82395dc81
Tried changing an existing test from using oZ to oA which revealed a problem with the csNames comparison (and matching the map orderings)
2008-11-16 13:05:30 +00:00
Neil Brown
f2bac46655
Added a testPatternMatchOneOf function to check that something matches at least one of a list of given patterns
2008-11-16 13:03:28 +00:00
Neil Brown
6f54b89b38
Added a permutations function to the Utils module
2008-11-16 13:03:04 +00:00
Neil Brown
278b80932e
Converted one of the input case tests to use the occam EDSL, making it much clearer
2008-11-16 12:24:41 +00:00
Neil Brown
42e4ca5c92
Adjusted an existing testcase for the changes in OccamEDSL
2008-11-16 12:24:24 +00:00
Neil Brown
559ba83c28
Developed the occam EDSL further, adding support for input CASE statements, more type-classes to allow easier use and various other improvements
2008-11-16 12:21:22 +00:00
Neil Brown
5fbbce6480
Adjusted the TAGS generation to include the tocktest source files
2008-11-16 11:35:57 +00:00
Neil Brown
02a28b7585
Made testOccamPass more general, so that it does not have to be applied at the top-level
2008-11-15 20:13:33 +00:00
Neil Brown
a570f2eff3
Renamed the variables in the occam EDSL to be less likely to clash in other modules
2008-11-15 20:11:52 +00:00