Commit Graph

32 Commits

Author SHA1 Message Date
Adam Sampson
06ff5ccda6 Implement short-form PLACE, and fix PLACE IN WORKSPACE/VECSPACE. 2008-03-17 18:47:54 +00:00
Adam Sampson
17a1c0eef6 Clean up INITIAL a bit and add a test case.
There's no need for INITIALs to be early-constant-folded, since -- unlike VALs
-- they can't be used in later constant folding.
2008-03-17 18:43:07 +00:00
Adam Sampson
1fb6adb005 Fix array constructors in occam.
This works at least for simple examples, although it's probably a bit
restrictive on the array indexes you're allowed; it should attempt to
constant-fold them.
2008-03-17 18:34:23 +00:00
Adam Sampson
69ce2dce15 Resolve conflicts after merge. 2008-03-17 15:57:04 +00:00
Neil Brown
6f35e1e36c Added support for array constructors to the occam parser 2008-03-10 22:58:36 +00:00
Neil Brown
b83bcc0f34 Added INITIAL variable abbreviations (as specifications) to the occam parser 2008-03-10 22:55:57 +00:00
Neil Brown
239dea3f36 Made the OF in CHAN OF optional in the occam parser 2008-03-10 22:43:18 +00:00
Adam Sampson
79a5799b8f Some minor cleanups to ParseOccam. 2008-03-15 14:10:51 +00:00
Neil Brown
c778ff0031 Fixed some unused module import warnings, now that PassM is not build of monad transformers 2008-03-10 17:19:45 +00:00
Neil Brown
6abda39ee2 Fixed a couple of uses of the PassM monad that depended on the old mechanism 2008-03-10 15:19:28 +00:00
Neil Brown
5c43172e46 Added an annotation to array subscripts to indicate whether they should have a run-time check added or not 2008-03-09 14:30:19 +00:00
Neil Brown
ba75f5b06c Removed the initialiser expression on the Declaration item in the AST 2008-03-09 00:23:13 +00:00
Adam Sampson
d2c0fd674e Rework the code for getting errors through the parser.
This used to work by adding a magic prefix to the error message, but it appears
that doesn't work with the GHC 6.6 version of Parsec. It now searches for a
magic substring anywhere in the error message.

It uses // as a delimeter rather than \0 now, since including nulls in Strings
causes problems -- for example, putStr "a\0b" will only print "a".
2008-03-04 12:52:25 +00:00
Adam Sampson
7ec6566495 Return sensible Meta from ParseOccam failures.
This means we get the nice annotated source display on a parser failure --
although we still get not-very-useful descriptions of errors sometimes...
2008-03-04 11:59:13 +00:00
Neil Brown
1e92333778 Added a try to fix the parsing of BYTESIN with a not obviously constant array dimension 2008-02-28 16:55:11 +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
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
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
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
bdda623d7e Added types to all the cases where the monomorhpism restriction applied 2008-01-26 20:51:11 +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
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
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
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
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
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
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