Commit Graph

31 Commits

Author SHA1 Message Date
Neil Brown
c8b724d2be Merged the latest set of changes from the trunk into the Polyplate branch
I also added the import list to all the Data.Generics imports in the tests (as I did for the other modules recently)
2009-04-10 20:38:29 +00:00
Neil Brown
ccb6c7aa1d Fixed the types in various test modules to work with Polyplate 2008-12-14 19:18:00 +00:00
Neil Brown
ddbec737f2 Got all the tests compiling again after recent changes
For some reason, the usage check tests are now very slow to run (perhaps because of all the operator definitions added to each one?), which needs further investigation.
2009-04-10 19:29:40 +00:00
Neil Brown
e457d82f0c Changed FUNCTIONs and PROCs to have optional bodies, and put all the externals into the AST (without bodies)
This may seem like an odd change, but it simplifies the logic a lot.  I kept having problems with passes not operating on externals (e.g. functions-to-procs, adding array sizes, constant folding in array dimensions) and adding a special case every time to also process the externals was getting silly.

Putting the externals in the AST therefore made sense, but I didn't want to just add dummy bodies as this would cause them to throw up errors (e.g. in the type-checking for functions).  So I turned the bodies into a Maybe type, and that has worked out well.

I also stopped storing the formals in csExternals (since they are now in csNames, and the tree), which streamlined that nicely, and stopped me having to keep them up to date.
2009-04-04 14:56:35 +00:00
Neil Brown
e91c075bcf Fixed up a lot of the failing tests
I changed a little bit of the code, but mainly the tests.  Several of the remaining failures are actually real failures, so I need to dig through the rest carefully.  A lot are failing because the C++ backend is broken.
2009-04-01 11:49:37 +00:00
Neil Brown
56e5b8da8e A mega-patch that gets tocktest compiling again
However, around a quarter of the tests currently fail...
2009-03-31 17:56:56 +00:00
Neil Brown
8492dc03d4 Introduced a ShareMode in the AST, and used it in the channel attributes (rather than Bool) 2009-03-22 22:29:39 +00:00
Neil Brown
9c4b8e8df1 Changed tocktest so you can pass it -v options for use with the automatic tests 2009-02-08 16:33:53 +00:00
Neil Brown
6afbb80e9f Fixed some of the test modules to work with the new array literals and constructors 2009-02-03 11:19:21 +00:00
Neil Brown
4f83187549 Fixed up all the tests in light of the new recursive procs 2009-01-29 00:56:32 +00:00
Neil Brown
10e6b4ce02 Updated all the tests to work with the new recursive functions 2009-01-29 00:34:12 +00:00
Neil Brown
2c6f624ea3 Changed the occam type-checker and the Rain stuff to be okay with the new step count 2009-01-28 23:47:36 +00:00
Neil Brown
1adca155dd Added a file full of tests for inferring direction specifiers in PROC formals 2009-01-20 23:43:42 +00:00
Neil Brown
1f4796e07f Fixed all the tests to reflect the new channel-end system, such that they all pass again
This is the last patch (for now) of the set implementing the new channel-end system
2009-01-20 17:41:44 +00:00
Adam Sampson
62a0873d3d Implement channel direction decorators.
This is mostly straightforward: modify the parser to allow direction
decorators in the right places, and extend the type checker to match.
There's some slight awkwardness in that some of the Types functions
have to perform the same checks as the type checker (e.g. directing a
non-channel), so I've tidied up their error messages a bit.

At the backend, I've just added a little pass to strip out all the
DirectedVariables, since the other backend passes don't handle them
gracefully. From the occam/C point of view this is fine, but I'm not
sure if it's going to cause problems for C++.
2008-06-09 21:35:20 +00:00
Neil Brown
41ff60cb78 Removed the Rep constructor from Structured and instead added a Rep constructor to SpecType
This way, all replicators are declared like other names, and their scope is considered replicated.  This simplifies the code a little.

Fixes #55
2008-06-04 17:00:43 +00:00
Adam Sampson
6ee21f76c9 Initial work on supporting INITIAL and RESULT abbreviations.
This fixes the AST, parser and typechecker, and adds a pass to
transform Result back into Abbrev, but doesn't transform Initial yet.
(It actually works for trivial stuff anyway, but it won't do the right
thing for complex types or PROC parameters.)

It appears (to me) to make sense to support INITIAL/RESULT reshaping
and retyping too, so this does.

Refs #42.
2008-06-02 20:41:37 +00:00
Neil Brown
ba66cce89f Moved all the remaining pass information to be with the passes themselves, and adjusted the tests accordingly
All the passes now have their information (name, pre-requisites and post- properties) stored at the point where the pass is declared, which means the pass lists are just a simple list of pass functions.

The main consequence of this change was that the tests had to be changed.  Now, instead of taking a "pass applied to data" item (type: PassM b), they take both the pass (type: Pass) and source data (type: b), and apply them later.  This was the decision that involved the simplest changes to the existing tests (simply unbracketing the application of the pass to the source).  I also had to include a few old-style versions though (testPass', testPassShouldFail') for where the functions were being used to test things that weren't actually passes (mainly StructureOccam).

Fixes #48
2008-06-02 14:31:19 +00:00
Adam Sampson
8b3eba594d Add SubscriptCheck field to SubscriptFromFor etc.
This makes it possible to mark a slice as not needing runtime
checking, which is immediately useful for _sizes arrays.

This fixes cgtest03, which was previously failing to compile because
the _sizes array for one of the constants in it contained a runtime
check and thus wasn't itself constant. I've added a testcase file for
the relevant bit of code.
2008-05-26 17:36:26 +00:00
Neil Brown
3daf82d318 Merged Alternative and AlternativeCond into a single Alternative item that always has a pre-condition 2008-04-03 14:52:37 +00:00
Adam Sampson
3283b7db41 Remove the Type/AbbrevMode information from Actual*.
It's redundant, since you can always compute them from the variable, and it
makes the code that deals with actuals rather cleaner.

On the other hand, it slightly complicates some of the tests, because any names
you use in an Actual need to be defined...
2008-03-26 18:16:09 +00:00
Adam Sampson
b36068b815 Move retypes check into the SpecType checker, and update the pass list.
This completes the occam typechecker.
2008-03-26 14:39:12 +00:00
Adam Sampson
ef329e3ed0 Check SpecTypes. 2008-03-26 14:20:35 +00:00
Adam Sampson
c9cb7d2bf9 Check Proc calls. 2008-03-26 12:26:04 +00:00
Adam Sampson
b672900f46 Check Case, Alt, and all the trivial processes. 2008-03-25 17:27:33 +00:00
Adam Sampson
6861b22da6 Check timer operations. 2008-03-25 16:45:25 +00:00
Adam Sampson
d7e829b4c6 Check assignments. 2008-03-25 16:26:09 +00:00
Adam Sampson
b3e3308b3e Implement channel IO checks, and refactor OccamTypes (again). 2008-03-25 15:56:03 +00:00
Adam Sampson
b8b7e04b7c Refactor literal and subscript checks.
For both of these, we already examine all the places they occur for other
reasons, so there's no good reason to do a separate traversal for them.
2008-03-22 23:58:18 +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
6ab4a9923f Implement expression typechecking for occam.
There's obviously some overlap with the Rain typechecker here. I've tried to
cover everything in the AST that could potentially be bound into occam at some
point in the future, even if the occam parser doesn't support it yet (so
this'll do checks for Concat and mobile allocation, for example).
2008-03-22 01:00:42 +00:00