Commit Graph

45 Commits

Author SHA1 Message Date
Adam Sampson
bfd7b079a7 Make unsubscriptType handle Infer. 2008-04-06 18:42:40 +00:00
Adam Sampson
1640b9ce63 Move applyDimension into Types. 2008-04-06 15:32:35 +00:00
Adam Sampson
aa3b17b555 Make protocolItems give a more useful error message on failure. 2008-04-06 02:50:46 +00:00
Adam Sampson
71df38813f Make subscriptType and trivialSubscriptType aware of Infer.
Subscripting Infer gives you Infer.

This also makes trivialSubscriptType handle user types in the same way as
subscriptType. (There probably isn't much reason to have both any more, since
subscriptType doesn't do the checks it used to do.)
2008-04-06 02:27:07 +00:00
Adam Sampson
ef329e3ed0 Check SpecTypes. 2008-03-26 14:20:35 +00:00
Neil Brown
6f76f6385e Added to an error message in Types to help determine the problem 2008-03-23 00:07:48 +00:00
Neil Brown
e767e33190 Added support for some intrinsic (time-related) functions in Rain 2008-03-22 18:58:10 +00:00
Adam Sampson
60ca26128c More occam typechecks: input/output items, replicators, choices.
Various infrastructure too to support these.

Doing A.ForEach raised an interesting question: what does it work over?  In
plain occam it'd just be arrays, but it should obviously work for lists too.
This suggests that Size and Subscript should work on lists as well, since
ForEach will be implemented in terms of them. I've therefore introduced the
idea of a "sequence" class of types.
2008-03-22 23:47:29 +00:00
Adam Sampson
388f2f38a6 plainSubscriptType doesn't really need to know what the subscript is. 2008-03-22 00:53:46 +00:00
Adam Sampson
56de093739 Add isScalarType. 2008-03-22 00:53:13 +00:00
Neil Brown
33b04e7646 Tidied up a few unused functions and module imports 2008-03-21 15:16:36 +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
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
35ebd43f79 Fixed some error messages in the Types module 2008-03-19 17:02:45 +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
Adam Sampson
b1416bb0cf Change A.Dimension to take an Expression, not an Int.
This touches an awful lot of code, but cgtest07/17 (arrays and retyping) pass.

This is useful because there are going to be places in the future where we'll
want to represent dimensions that are known at runtime but not at compile time
-- for example, mobile allocations, or dynamically-sized arrays. It simplifies
the code in a number of places.

However, we do now need to be careful that expressions containing variables do
not leak into the State, since they won't be affected by later passes.

Two caveats (marked as FIXMEs in the source):

- Retypes checking in the occam parser is disabled, since the plan is to move
  it out to a pass anyway.
- There's some (now very obvious) duplication, particularly in the backend, of
  bits of code that construct expressions for the total size of an array
  (either in bytes or elements); this should be moved to a couple of helper
  functions that everything can use.
2008-03-18 16:45:38 +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
Neil Brown
8030161a90 Changed bytesInType to use the new module for getting the size of the bool and int types 2008-03-07 21:24:20 +00:00
Adam Sampson
2f7539bcdb Convert the C backend to the new CIF API (mostly).
Most of this is mechanical: changing function names, and carrying the "wptr"
argument around. I've made the code for computing Expressions from Structureds
a bit more generic too.

The only complex bit is the handling of PAR processes, which I'm not very happy
with at the moment; they used to use the normal C calling convention, but now
you need to pack the arguments into the workspace. I'm handling this at the
moment by generating wrapper functions that do the unpacking, but it would be
better in the future to make the wrapper PROCs that we already generate have
the right interface.

This won't work for programs that use any of the top-level channels yet, since
there are no handlers for them.
2008-03-07 17:50:10 +00:00
Neil Brown
f5022228ba Fixed typeOfSpec to use the recorded type rather than trying to dig it out of the inner expression/variable 2008-02-29 16:33:33 +00:00
Neil Brown
1afea6c62c Fixed underlyingType not recursing properly into the inner types in arrays 2008-02-27 18:23:53 +00:00
Neil Brown
caff04c548 Changed the use of everywhereM in underlyingType to use makeGeneric instead 2008-02-24 15:52:09 +00:00
Neil Brown
a3ebd96a86 Changed all the functions in the EvalLiterals, Types and ShowCode modules to use CSMR (instead of CSM) 2008-02-08 11:24:37 +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
741a01de5a Removed various tab characters and replaced them with spaces 2008-01-26 19:38:24 +00:00
Douglas Warren
1d83167c01 Fixed some haddock parsing problems in the documentation 2007-11-14 16:26:47 +00:00
Neil Brown
a6cbdfeb94 Changed some functions in the Types module to handle the new List type 2007-10-25 10:11:19 +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
31642036b7 Added support for the new AllocMobile item in the Types module 2007-10-24 19:31:07 +00:00
Neil Brown
f68a6cd31d Added cases for DerefVariable to some functions in Types 2007-10-24 15:57:03 +00:00
Neil Brown
a68ecfb24b Added a new function (typeOfSpec) to the Types module 2007-10-10 23:10:46 +00:00
Neil Brown
c59c2ed5f6 Removed an unused function (simplifyType) from the Types module 2007-10-02 14:48:09 +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
47052d5f39 Fixed a bug where the default cases were left out for the recent "genericised" functions in the Types module 2007-09-27 10:59:35 +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
629137443f Scrapped some boilerplate in Types by changing a couple of functions (simplifyType, underlyingType) to use generics 2007-09-18 18:37:53 +00:00
Neil Brown
1baecd7955 Moved findMeta into the Metadata module 2007-09-18 09:50:45 +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
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
1ea59d40bd Created an export list for the Types module, and added documentation to all the exported functions 2007-09-15 14:31:33 +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