Commit Graph

41 Commits

Author SHA1 Message Date
Adam Sampson
b296706bea Update Rain typechecker to match isIntegerType change.
isIntegerType now recognises Time as an integral type, so the rules for Time
operations in the Rain typechecker needed updating.
2008-03-26 14:55:15 +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
74a5cf52a7 Stopped constants being assigned to in the type-checker for Rain 2008-03-23 12:15:00 +00:00
Neil Brown
7a7b60449c Enhanced an error message in RainTypes 2008-03-22 19:04:34 +00:00
Neil Brown
813d6affd1 Fixed an error message in RainTypes 2008-03-22 18:02:43 +00:00
Neil Brown
7bd5bdf1fa Changed a Rain pass to transform the Plus operator on lists into the proper Concat operator 2008-03-21 19:23:16 +00:00
Neil Brown
8db5975671 Refactored checkExpressionTypes a little 2008-03-21 16:35:57 +00:00
Neil Brown
edf1060c9b Fixed conflicts in the Rain passes 2008-03-21 12:45:24 +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
cd58986721 Added a first implementation of the annotateListLiteralTypes pass 2008-03-20 16:35:09 +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
43b77ff1a0 Made names for loop variables unique in Rain, and made their abbreviation mode Abbrev 2008-03-19 17:19:58 +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
b8caf7c3b6 Move everywhereASTM into Pass. 2008-03-19 18:11:49 +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
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
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
a65953ad89 Rain: added type-checking for wait statements 2007-09-26 23:08:55 +00:00
Neil Brown
a12d46401a Rain: implementing type checking for inputs inside alts 2007-09-26 22:37:32 +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
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
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
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
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
feedce5a24 Removed unnecessary dependencies of a few non-test modules on TestUtil 2007-09-15 14:33:23 +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
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
01f763373d Rain: added a new pass for folding constants 2007-09-15 09:36:50 +00:00