Commit Graph

295 Commits

Author SHA1 Message Date
Neil Brown
7af49a2d10 Fixed the checkFunction pass 2008-02-25 21:27:37 +00:00
Neil Brown
dcf419744a Renamed the transformFunction pass into checkFunction, and adjusted the tests for it accordingly 2008-02-25 21:17:37 +00:00
Neil Brown
74838bcb80 Fixed functions to work again in the Rain parser, according to the new tests 2008-02-25 17:18:28 +00:00
Neil Brown
839c8ebe7c Fixed the tests for parsing Rain functions, using the new Process body with functionname = returnvalue plan 2008-02-25 17:17:38 +00:00
Neil Brown
1edaacae89 Altered the AST to allow a function to be either an ExpressionList (classical occam) or a Process (Rain/proposed new occam) 2008-02-24 19:29:31 +00:00
Neil Brown
74f3cb7fc2 Removed the export of "m" in TestUtils, instead moving the definition to each module that uses it (less confusing that way) 2008-02-24 18:55:44 +00:00
Neil Brown
2e6718ac50 Changed all the lists of passes to add pre- and post- properties 2008-02-19 09:43:40 +00:00
Neil Brown
360abc195e Moved the enabling/disabling of passes based on CompState from PassList to the point of the declaration of the passes 2008-02-16 11:09:25 +00:00
Neil Brown
3ce0eaf452 Made the first adjustment to the Pass system, ready to introduce properties and a dependency graph. For now passes are still executed in list order 2008-02-16 10:19:14 +00:00
Neil Brown
b037b6a8ca Tidied up the new code relating to warnings, and moved it all into the Errors module (out of CompState and Pass) 2008-02-08 13:31:37 +00:00
Neil Brown
f17ff5071c Added a Warn monad for warnings, and incorporated a WriterT monad into the PassM stack to support the Warn monad, then changed all the rest of the code accordingly, including adding a Warn instance for the GenParser parser that hides it in the state 2008-02-08 13:22:23 +00:00
Neil Brown
95cdb39789 Generalised the type of the monad for the excludeConstr function, and correspondingly the functions that use it 2008-02-08 11:33:19 +00:00
Neil Brown
e3e9e912f2 Added a read-only version of CSM, named CSMR 2008-02-08 11:17:50 +00:00
Neil Brown
1fd85fbe51 Added the -fwarn-missing-signatures option and added all missing type signatures for non-test modules (and most for test modules too) 2008-02-05 23:06:03 +00:00
Neil Brown
acd57d74de Changed the A.Structured type to be parameterised
This patch is actually an amalgam of multiple (already large) patches.  Those patches conflicted (parameterised Structured vs. changes to usage checking and FlowGraph) and encountered a nasty bug in darcs 1 involving exponential time (see http://wiki.darcs.net/DarcsWiki/ConflictsFAQ for more details).  Reasoning that half an hour (of 100% CPU use) was too long to apply patches, I opted to re-record the parameterised Structured changes as this new large patch.  Here are the commit messages originally used for the patches (which, as mentioned, were already large patches):

A gigantic patch switching all the non-test modules over to using parameterised A.Structured
Changed the FlowGraph module again to handle any sort of Structured you want to pass to it (mainly for testing)
A further gigantic patch changing all the tests to work with the new parameterised Structured
Fixed a nasty bug involving functions being named incorrectly inside transformInputCase
Added a hand-written instance of Data for Structured that allows us to use ext1M properly
Fixed a few warnings in the code
2008-02-05 19:40:27 +00:00
Neil Brown
6c4e7ee713 Added a few more TestLabels 2008-02-05 16:19:16 +00:00
Neil Brown
edc3a7e910 Removed the die function (that has no source position) and as far as possible replaced all its uses with dieP and a valid position 2008-01-28 17:21:13 +00:00
Neil Brown
2120b830dc Corrected the use of the -fno-warn-tabs flag in the alex files so that it works under GHC 6.6.x 2008-01-28 12:03:03 +00:00
Neil Brown
bdda623d7e Added types to all the cases where the monomorhpism restriction applied 2008-01-26 20:51:11 +00:00
Neil Brown
741a01de5a Removed various tab characters and replaced them with spaces 2008-01-26 19:38:24 +00:00
Neil Brown
34584130d4 Turned off tab warnings for the files auto-generated by Alex (which contain a lot of tabs) 2008-01-26 19:37:43 +00:00
Neil Brown
0706cb4d51 Rearranged PreprocessOccam a little so that you can now parse occam source directly from a String (as well as from a filename, as before) 2008-01-16 03:26:49 +00:00
Neil Brown
26dd2fa5c4 Renamed the TestUtil and TreeUtil modules to TestUtils and TreeUtils, to be consistent with the Utils module 2007-12-13 19:05:29 +00:00
Neil Brown
4c20f99ac3 Changed some tests to use the new mSeq matching helpers 2007-11-28 14:30:56 +00:00
Neil Brown
8ec8374bc6 Converted most of ParseRainTest to use the pat function with normal AST fragments, rather than the more verbose explicit Patterns 2007-11-21 15:33:17 +00:00
Neil Brown
14cb5d7642 Changed some Named Patterns to use the new @@ operator 2007-11-21 14:26:08 +00:00
Neil Brown
1a7d77d9c4 Added more documentation to the tests for the Rain frontend passes 2007-11-12 15:45:07 +00:00
Neil Brown
da76be9dab Changed RainParseTest to stop relying on the Meta tag hack, and also added some more documentation. 2007-11-10 14:13:14 +00:00
Neil Brown
16df6a1774 Fixed some conflicts between some branches, in RainPassesTest 2007-10-28 18:34:28 +00:00
Neil Brown
25f2efb94c Changed the existing Rain code (and tests) to use the new List type rather than the Array type 2007-10-25 10:13:17 +00:00
Neil Brown
6b95827cab Added an optional initialiser-expression to Declaration in the AST, and changed the rest of the code accordingly 2007-10-24 23:50:00 +00:00
Neil Brown
7d8f170b7d Added support for the #COMMENT directive to the occam parser 2007-10-15 17:12:53 +00:00
Neil Brown
d4a766c594 Changed the occam parser to use A.Several with an empty list for its terminator, rather than A.Main 2007-10-17 13:43:12 +00:00
Neil Brown
e582f5e508 Changed the terminator in Rain source files from A.Main to A.Several (with an empty list), and updated the tests accordingly 2007-10-17 13:42:13 +00:00
Neil Brown
1c858e112c Changed the occam and Rain parsers to return a Structured rather than a Process (which will simplify the generated ASTs) 2007-10-17 13:21:17 +00:00
Neil Brown
15ecb2b178 Added the -fwarn-type-defaults compiler option (for when integer literals are given a default type) and fixed the few warnings that arose from doing so 2007-09-27 13:29:16 +00:00
Neil Brown
38c409d378 Added the -fwarn-unused-imports compiler option to warn about unused imports, and then set about pruning and ordering (mostly in my code) the import lists for all the modules 2007-09-27 13:13:46 +00:00
Neil Brown
028c27eb73 Rain: implemented type-checking for wait guards 2007-09-26 23:42:40 +00:00
Neil Brown
c38978c123 Rain: added tests for checking types in wait guards 2007-09-26 23:42:16 +00:00
Neil Brown
d79de5a936 Rain: implemented parsing of wait guards 2007-09-26 23:34:55 +00:00
Neil Brown
cbd2d04371 Rain: added tests for parsing wait guards 2007-09-26 23:34:42 +00:00
Neil Brown
a65953ad89 Rain: added type-checking for wait statements 2007-09-26 23:08:55 +00:00
Neil Brown
41ac788601 Rain: added tests for checking the types in wait statements 2007-09-26 23:08:37 +00:00
Neil Brown
5af96110c7 Rain: implemented the parsing of wait statements 2007-09-26 23:00:58 +00:00
Neil Brown
13584ed2cb Added a wait statement to the AST, and added Rain tests for parsing wait statements 2007-09-26 23:00:09 +00:00
Neil Brown
a12d46401a Rain: implementing type checking for inputs inside alts 2007-09-26 22:37:32 +00:00
Neil Brown
5c827fdacb Rain: added testing for correct types in input statements in alts 2007-09-26 22:37:03 +00:00
Neil Brown
4cc0628757 Corrected the name of one of the RainTypesTest tests 2007-09-26 22:24:01 +00:00
Neil Brown
db4f05932b Fixed a conflict between the old time-related patches and the new alt patches 2007-09-26 21:39:16 +00:00
Neil Brown
769dc3c79a Rain: changed the if, while and each loops to require a block as their body, rather than just a statement. 2007-09-26 18:03:42 +00:00
Neil Brown
68c468fbea Rain: added the parsing of else (skip) guards in alts 2007-09-26 19:56:22 +00:00
Neil Brown
420839ef1e Rain: added tests for parsing else guards in alts 2007-09-26 19:56:11 +00:00
Neil Brown
9c87478110 Corrected a test number in ParseRainTest 2007-09-26 19:44:33 +00:00
Neil Brown
205b090cef Rain: implemented the parsing of alt statements 2007-09-26 19:40:04 +00:00
Neil Brown
9cfbed3c6e Rain: added tests for parsing alt statements 2007-09-26 19:39:37 +00:00
Neil Brown
1f298a8ff6 Rain: added parsing support for time 2007-09-19 12:04:11 +00:00
Neil Brown
ae262125da Rain: added parse tests for things related to time 2007-09-19 12:03:55 +00:00
Neil Brown
ebf3040367 Rain: tidied up ParseRain a little 2007-09-19 12:03:24 +00:00
Neil Brown
4e635d84ba Rain: added a pass for checking the types in GetTime processes 2007-09-19 11:36:55 +00:00
Neil Brown
c925774280 Changed the types code so that all the tests for the new Time type pass 2007-09-19 11:24:14 +00:00
Neil Brown
5eb149d598 Rain: added type-checker tests for the Time type 2007-09-19 11:23:41 +00:00
Neil Brown
c97d1d00c8 Changed the error type from String to ErrorReport throughout the code
ErrorReport is of type (Maybe Meta, String), thereby adding an optional code position to error messages.

Die has been changed so that die and dieP are now implemented in terms of dieReport (:: ErrorReport -> m a).  This involved changing less code than changing die to be of type ErrorReport -> m a.  All that had to be changed directly was that Die instances now implement dieReport instead of die.

Any bits of code that "caught" errors has been changed so that it handles ErrorReport instead of String.  This ErrorReport is eventually, in Main, passed to dieIO, which will soon be changed to read the file in and provide the context.  Accordingly, MonadIO m has been added as a constraint to dieIO, and dieInternal has been changed to no longer use dieIO (because really we can't add the MonadIO constraint to dieInternal).

Various error messages have been changed.  Notably, all instances of fail in ParseOccam have been changed to use die or, wherever possible, dieP.  A similar thing has been done in EvalConstants and EvalLiterals.
2007-09-18 10:17:38 +00:00
Neil Brown
a4453fe3c3 Rain: changed parse errors to report using dieP (with a Meta position) instead of just dieIO 2007-09-17 11:18:38 +00:00
Neil Brown
d92e042159 Moved the functions for converting between Meta and SourcePos (from Parsec) into a common ParseUtils module 2007-09-17 11:15:17 +00:00
Adam Sampson
fd2109d548 Fix a dummy filename that I'd forgotten to change. 2007-09-17 23:12:23 +00:00
Neil Brown
3e342a621c Added ShowOccam and ShowRain type-classes, and changed existing code to use these new show methods in error messages
The function showCode shows code as either occam or Rain depending on the frontend.  This is then used by a formatCode function that acts similar to 
printf, which makes it easy to format error messages that use showCode.
2007-09-16 17:20:57 +00:00
Neil Brown
6c3864cdfd Rain: wired up the new type-checking passes 2007-09-16 12:09:22 +00:00
Neil Brown
c61f2ea617 Rain: added checks that types match in input and output statements 2007-09-16 11:46:01 +00:00
Neil Brown
337ad7fd32 Rain: added type-checking tests for if and while conditionals 2007-09-16 09:59:30 +00:00
Neil Brown
5354c99a4e Rain: added a function and tests for checking the types involved in assignments 2007-09-16 09:18:12 +00:00
Neil Brown
9ef8343c3a Rain: moved matchParamPass into RainTypes 2007-09-15 21:29:30 +00:00
Neil Brown
9965c7373e Rain: removed an outdated comment 2007-09-15 21:20:41 +00:00
Neil Brown
3301207a97 Rain: added more type-checkers tests, all of which pass 2007-09-15 21:19:16 +00:00
Neil Brown
15ce5fee06 Rain: added more type-checker tests and made them pass 2007-09-15 21:01:10 +00:00
Neil Brown
eeacaf1de4 Rain: added tests for type-checking monadic integer expressions, and made them pass 2007-09-15 20:30:41 +00:00
Neil Brown
a454aa78f8 Rain: implemented the checkExpression function and got it passing the tests so far 2007-09-15 18:57:02 +00:00
Neil Brown
7f9357d658 Rain: changed from using the isSafeConversion function to a more appropriate new function isImplicitConversionRain 2007-09-15 18:54:19 +00:00
Neil Brown
f9c21dc4c7 Rain: fixed a nasty copy-and-paste mistake in RainTypesTest 2007-09-15 18:35:13 +00:00
Neil Brown
feedce5a24 Removed unnecessary dependencies of a few non-test modules on TestUtil 2007-09-15 14:33:23 +00:00
Neil Brown
2bef926238 Tidied up and expanded the expression type-checker tests 2007-09-15 13:37:53 +00:00
Neil Brown
a5c2dedb24 Changed the testPass* functions in TestUtil to return Assertion instead of Test 2007-09-15 13:35:51 +00:00
Neil Brown
f9c88cbe90 Rain: added tests for a pass that type-checks expressions 2007-09-15 13:13:00 +00:00
Neil Brown
9ffb5b5931 Rain: corrected a comment in RainPasses 2007-09-15 11:25:35 +00:00
Neil Brown
4221b0d698 Moved a function from RainPassesTest into TestUtil 2007-09-15 11:24:49 +00:00
Neil Brown
bad3f0818a Rain: implemented the pass to record the types of integer literals 2007-09-15 10:55:53 +00:00
Neil Brown
97cc82e235 Rain: added tests for a pass to fix the types of (folded) integer literals 2007-09-15 10:40:00 +00:00
Neil Brown
989f12b051 Rain: fixed the constant folding pass to work with constant sub-expressions 2007-09-15 10:26:52 +00:00
Neil Brown
e35873f01c Rain: tidied up the tests for the constant folding pass 2007-09-15 10:07:48 +00:00
Neil Brown
01f763373d Rain: added a new pass for folding constants 2007-09-15 09:36:50 +00:00
Neil Brown
4d09fd4a85 Rain: added a pass that moves declarations inside par blocks to being outside the par blocks (so that they are in scope for the whole of the par block) 2007-09-14 13:03:59 +00:00
Neil Brown
3f573dabd5 Rain: corrected innerBlock to work sensibly with multiple declarations (particularly for the start of par blocks) 2007-09-14 12:53:26 +00:00
Neil Brown
ff9b0d6611 Rain: changed the innerBlock parser to work with the new rules for declarations in par blocks, and also simplified its output slightly 2007-09-14 12:22:12 +00:00
Neil Brown
59d86a0afc Rain: stopped semi-colon being a valid statement by itself 2007-09-14 11:46:18 +00:00
Neil Brown
c40d94c655 Added a couple of passes that check the validity of the AST at the beginning and end of the Rain passes 2007-09-12 08:50:19 +00:00
Neil Brown
2ff46a9041 Rearranged the Rain source files, renamed a couple of Rain files, and changed the Makefile accordingly. 2007-09-10 17:28:57 +00:00