Commit Graph

1456 Commits

Author SHA1 Message Date
Neil Brown
cfccd38c51 Changed transformConstr to transform list-typed array constructors to build up a list rather than subscripting it 2008-03-21 19:22:29 +00:00
Neil Brown
a1daf15576 Pulled up list expressions in a similar way to array expressions 2008-03-21 19:21:46 +00:00
Neil Brown
bc7e682119 Added a Concat operator for lists, and added support for it (and list assignment) to the backends 2008-03-21 19:20:15 +00:00
Neil Brown
da5801ad03 Refactored transformConstr to pull out some of its working into helper functions 2008-03-21 19:13:54 +00:00
Neil Brown
80ffc87f94 Added a newline at the end of the generated C++ files 2008-03-21 18:47:09 +00:00
Neil Brown
ebef4aaedf Fixed array constructors by adding an occam pass to figure out their type early on, and also corrected the ordering of the later passes 2008-03-21 18:23:42 +00:00
Neil Brown
8db5975671 Refactored checkExpressionTypes a little 2008-03-21 16:35:57 +00:00
Neil Brown
3fede166f6 Added another Rain testcase 2008-03-21 16:35:21 +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
142926172d Fixed the error message given when there is a problem with the pass dependency graph 2008-03-21 14:51:54 +00:00
Neil Brown
273aeead4e Added the code to guess the frontend based on the file extension (.occ/.rain) 2008-03-21 14:46:28 +00:00
Neil Brown
edf1060c9b Fixed conflicts in the Rain passes 2008-03-21 12:45:24 +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
022447b04c Added a couple of Rain testcases 2008-03-20 16:54:03 +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
d4991461a5 Fixed the type of a list for the empty list 2008-03-20 16:44:36 +00:00
Neil Brown
0e3465afc0 Corrected some Rain tests to avoid using the Int type 2008-03-20 16:42:25 +00:00
Neil Brown
cd58986721 Added a first implementation of the annotateListLiteralTypes pass 2008-03-20 16:35:09 +00:00
Neil Brown
185f68e96d Adjusted the tests for the annotateListLiteralTypes pass 2008-03-20 16:34:44 +00:00
Neil Brown
a6452f93df Added a ShowOccam and ShowRain instance for lists of things 2008-03-20 16:34:11 +00:00
Neil Brown
ecb82d13a8 Revamped the ShowCode module, transforming it to use the writer monad 2008-03-20 16:20:14 +00:00
Neil Brown
bd26f758b4 Added tests for annotating the types of list literals and ranges in Rain 2008-03-20 14:44:19 +00:00
Neil Brown
8f51ead090 Rewrote transformRangeRep, stopping it requiring constants in ranges 2008-03-20 12:40:07 +00:00
Neil Brown
b20a7fcb0b Fixed some tests in ParseRainTest 2008-03-20 12:39:42 +00:00
Neil Brown
1f6311d33e Fixed a lot of tests in RainPassesTest 2008-03-20 12:38:59 +00:00
Neil Brown
123936e71c Changed addOne to use Add not Plus (we can always define a plusOne...) 2008-03-20 12:30:07 +00:00
Neil Brown
ad7a76dace Altered transformEachRange to make it more straight-forward 2008-03-20 09:36:26 +00:00
Neil Brown
713b5c3e5c Added a subExprs helper function to match the rest 2008-03-19 17:52:01 +00:00
Neil Brown
b496912c51 Fixed conflicts with Adam's dimension changes 2008-03-19 17:49:32 +00:00
Neil Brown
05866457e4 Fixed the type of a range to at least be a list 2008-03-19 17:34:12 +00:00
Neil Brown
839d92546b Altered the backends to support lists and foreach loops over lists (at least in the C++ part) 2008-03-19 17:20:52 +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
e2f5d18169 Added a case in pullRepCountSeq for ForEach replicators 2008-03-19 17:15:14 +00:00
Neil Brown
35ebd43f79 Fixed some error messages in the Types module 2008-03-19 17:02:45 +00:00
Neil Brown
45c2619307 Changed the rain parser to use ListLiteral for strings 2008-03-19 15:59:23 +00:00
Neil Brown
9d0459cb75 Added a ListLiteral item to the AST 2008-03-19 15:58:34 +00:00
Neil Brown
722499b05d Adjusted the test for transformConstr to work properly with the new array constructor type 2008-03-19 13:29:02 +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
Neil Brown
cb819d142a Altered transformConstr to handle array constructors with types in them 2008-03-19 13:23:20 +00:00
Neil Brown
a930e17f89 Adjusted the parsers to store a type with array constructors (Rain will infer it later, so it uses Any) 2008-03-19 13:22:35 +00:00
Neil Brown
7baeb318f2 Adjusted the Types module to use the new types in array constructors 2008-03-19 13:21:42 +00:00
Neil Brown
ff9c0549ca Added types to the array constructor items in the AST 2008-03-19 13:21:12 +00:00
Neil Brown
95fd6321d1 Added support for parsing list types in Rain 2008-03-18 11:53:57 +00:00
Neil Brown
806a5b9834 Added the tests for parsing list types in Rain 2008-03-18 11:52:59 +00:00
Adam Sampson
eb29e65bad Smarter tree traversals: "Scrap Your Uniplate".
This provides gmapMFor and gmapMFor2, which are like gmapM, but know what
they're looking for, and can therefore avoid going down branches of the tree
that won't contain any interesting types.

The basic approach is quite similar to Uniplate's PlateData: there's a function
(containsType) that'll tell you whether one type is contained somewhere within
another. However, unlike Uniplate, we build a static IntMap IntSet of the types
we need to know about, which allows rather quicker lookups. (I did try using
PlateData first.)

The result is that applyDepthM is now much quicker than it was before.
applyDepthM2 is a bit less impressive, which I assume is because it can't
really prune the tree much if it's looking for two types.

Future enhancements:
- convert more passes to use applyDepthM*;
- make gmapMFor* aware of constructors rather than just types, which should
  allow a bit more pruning.
2008-03-20 16:49:24 +00:00
Adam Sampson
746e360a4a Rename everywhereASTM to applyDepthM, and add a two-type version.
The renaming is because I can never remember which of everywhere and
everywhere' goes depth-first...
2008-03-20 11:40:19 +00:00
Adam Sampson
52d72647ae Fix the transformConstr0 test by defining x. 2008-03-20 11:23:45 +00:00