Commit Graph

1278 Commits

Author SHA1 Message Date
Neil Brown
66fc1d706e Rain: tidied up the transformEach pass 2007-08-18 10:28:22 +00:00
Neil Brown
18fa9cdb65 Rain: added another test for the transformEach pass 2007-08-18 10:21:44 +00:00
Neil Brown
7e255f2218 Cleared up the error messages in assertPatternMatch in TreeUtil 2007-08-18 10:20:11 +00:00
Neil Brown
1cc005f829 Added checks for consistent patterns in checkMatch in TreeUtil 2007-08-18 10:09:09 +00:00
Neil Brown
e397e95364 Simplified the checkConsEq function a little in TreeUtil 2007-08-18 10:05:09 +00:00
Adam Sampson
5628f93db6 Fix some Haddock syntax (comments that shouldn't have been Haddock) 2007-08-17 18:21:29 +00:00
Neil Brown
a49c462ca1 Corrected the test of the rain foreach-pass -- the test now passes 2007-08-16 14:17:44 +00:00
Neil Brown
e6d4425e82 Improved the printing of Patterns so that more helpful and readable output is produced when a test fails 2007-08-16 14:11:58 +00:00
Neil Brown
b9a78e99e4 Added to RainPassTest some code for setting up the defined names 2007-08-16 13:51:17 +00:00
Neil Brown
8a9ce4e205 Changed the rain for-each pass to extract the inner result type to check against, not the IO monad (oops) 2007-08-16 13:35:23 +00:00
Neil Brown
3d1d5e35ef Changed the rain foreach-pass test to actually run the transformEach pass it was meant to be testing, and also got the transformEach test to compile 2007-08-16 13:16:04 +00:00
Neil Brown
2d7349eb5d Added a new file for Rain passes, and a file for testing them, and altered the main test rig accordingly 2007-08-16 12:19:30 +00:00
Neil Brown
be340024ce Added some pattern matching utilities (mainly intended for matching the AST) 2007-08-16 12:18:48 +00:00
Neil Brown
5ee2303dc7 Moved some functions into TestUtil from RainParseTest 2007-08-16 12:17:49 +00:00
Neil Brown
151134e70a Fixed the conflict between the new AST documentation and the addition of the Rain ForEach constructor in the AST 2007-08-14 11:59:45 +00:00
Neil Brown
d574ec8e3d Added ForEach to the replicator possibilities in the AST, and tested parsing Rain seqeach and pareach loops 2007-08-13 16:05:17 +00:00
Neil Brown
2902d085a4 Rain: added support for string and numerical literals 2007-08-13 16:03:22 +00:00
Neil Brown
38b0272555 Rain: changed the name parse function to not require the type of the name 2007-08-13 15:58:44 +00:00
Neil Brown
d2022defb0 Changed the Rain parser to use the CompState of the occam parser 2007-08-07 18:43:20 +00:00
Adam Sampson
eab08e7af2 More updates to the AST documentation.
This consists mostly of syntax tweaks, although I've also added documentation
to a few types that didn't already have it.
2007-08-13 20:31:07 +00:00
Neil Brown
feebea4473 Changed the AST to distinguish reading a timer from reading a channel 2007-08-13 16:26:03 +00:00
Neil Brown
872864bf81 Added documentation to the AST 2007-08-07 16:18:01 +00:00
Adam Sampson
7bdbb3b729 Make csBackend a proper type, and make the options lowercase.
This is to match the handling of --mode.
2007-08-08 19:56:28 +00:00
Adam Sampson
6047836456 Add a first shot at the assembly analyser, and make GenerateC use it.
This does about the minimum necessary for assembly analysis to work. It assumes
that any function it hasn't been able to analyse itself needs 512 bytes (most
need far less); it doesn't do any flow analysis; it doesn't do a lot of sanity
checking. However, it produces sensible numbers, and works with the demos I've
tried so far.

I was originally going to make this a separate tool, but there are a number of
bits of the code can be nicely reused, so it's a separate "operating mode" in
the existing program (as is parse-only mode now).
2007-08-08 19:39:47 +00:00
Adam Sampson
d589cf0e46 Parse doesn't need readHex any more 2007-08-07 18:44:41 +00:00
Neil Brown
0eadc2302c Added mostneg and mostpos for my custom bool type, to get cgtest05 to compile 2007-08-06 22:42:50 +00:00
Neil Brown
00a617150e Improved time handling by using helper function 2007-08-06 22:36:23 +00:00
Adam Sampson
e0351ca367 Unbreak the Makefile 2007-08-07 12:56:50 +00:00
Neil Brown
1f9480eb89 Added support for checking that arrays are only used in parallel with constant subscripts
Note that this feature makes two assumptions:
- Constant folding has already been performed on the tree
- Array subscript literals will all be simply of type A.IntLiteral (with type A.Int), without any retyping, any expressions, etc
2007-08-07 12:18:29 +00:00
Neil Brown
26e2ff85aa Added more usage checking tests 2007-08-07 12:07:16 +00:00
Neil Brown
59e173a885 Made the literals in UsageCheckTests more distinct from the variables 2007-08-07 12:04:08 +00:00
Neil Brown
9c722ba27c Some tests for getting the parallel usage checker working on arrays and replicated pars properly 2007-07-31 09:43:59 +00:00
Neil Brown
2e39bd463d Deal with specifications in parallel usage checker 2007-07-30 22:39:58 +00:00
Neil Brown
bed325beea Parallel Usage Checker and Test Rearrangement
This patch is a bit large, being as it encompasses two major changes:

1. The addition of the first version of a parallel usage checker.  The usage checker uses the generics library (like
   the other passes) to work out if the parallel usage rules are broken.  It mainly consists of:
     a) a function used to determine which variables are written to/read from in given bits of code, and 
     b) a function that applies a) across the members of any par construct in the file, and checks that
        the expected usage rules hold
   The parallel usage checker is in an early stage, but I think the design is sensible - at least for doing the variable
   and array usage.  The channel usage checker will require some slightly different functionality, and
   I am not considering the abbreviation checker yet.
2. As a consquence of adding a second test file (UsageCheckTest) alongside the first (RainParseTest), I have 
   created a TestMain class that is intended to run all tests for all parts of Tock.  I have also extracted some
   useful helper functions (for creating the expected results of tests) into a file named TestUtil.  I've also
   modified the Makefil accordingly.
   
There are a few other minor changes to RainParse/RainParseTest that are also included in the patch as separating them
would have been tricky.
2007-07-30 22:04:30 +00:00
Adam Sampson
600467bbdd Clean up the Makefile a bit 2007-08-06 23:27:54 +00:00
Adam Sampson
2cf3579446 Fix an unused-bind warning -- rhsSizes isn't used when retyping 2007-08-06 23:24:12 +00:00
Neil Brown
0a0110d122 Added warning about unused binds to the compiler options
I have added my favourite compiler option "-fwarn-unused-binds" to the Makefile.  I've then changed GenerateCPPCSP to have one explicit export, and the
combination of the two would spot any future mistakes like not including the genAlt function in then GenOps structure (see previous patch).  This 
new warning option already spots one problem with GenerateC, and I have a feeling it will also be useful in future.
2007-08-06 20:33:48 +00:00
Neil Brown
5cfa79809b Added the cppgenAlt function to the GenOps (was missed out previously by accident) 2007-08-06 20:33:10 +00:00
Neil Brown
11928a327f Put genVariable' back in the C++CSP backend
It was my own fault of - I changed the genVariable' function in GenerateCPPCSP but forgot to move it out of the "taken verbatim from GenerateC" function,
so Adam removed it during the tidy-up.  I've reinstated it from the old version - I need the ".access()" part for accessing individual array elements.
2007-08-06 20:27:12 +00:00
Neil Brown
498e00c584 Fixed a bug that stopped arrays with a single dimension (that was also unknown) from having their sizes calculated in tockArrayView. cgtest09 now all passes 2007-07-31 22:04:31 +00:00
Neil Brown
7d7f66c626 Fixed a bug in the array indexing that was causing heap corruption 2007-07-31 21:58:34 +00:00
Adam Sampson
432d406f26 Fix an oddity Neil flagged -- yes, there is a nicer syntax for updating structures 2007-08-01 23:08:21 +00:00
Adam Sampson
687f6a10f6 Make it possible to inherit operations from GenerateC in other backends.
... and update GenerateCPPCSP to do so. This works by having a structure of
operations (GenOps) through which all the recursive calls go, and having
GenerateCPPCSP replace only the operations that it wants to override.
2007-08-01 22:42:00 +00:00
Neil Brown
a72224728a Updated documentation regarding arrays 2007-07-31 21:27:51 +00:00
Neil Brown
231b3042ac Increased the stack size for processes, to be on the safe side 2007-07-31 21:24:10 +00:00
Neil Brown
a52d115060 Changed arrays to use vector/tockArrayView
Previously the arrays used the Blitz++ library, but this was not totally satisfactory.  I have therefore resorted (after looking at many different
libraries) to using std::vector (which could perhaps be boost::array instead) coupled with a roll-my-own "array view" class (tockArrayView) that
easily allows all the functionality that we need from arrays (slicing, indexing, copying, unknown dimensions,retyping,reshaping).  I have also
had to introduce a nasty little wrapper class tockBool, because vector<bool> is a specialisation that totally breaks things.  If I do move to
boost::array, I will be able to remove tockBool.
2007-07-31 21:19:52 +00:00
Neil Brown
f997b823dc Rain: Parser and Parser-Test framework
Initial commit of the beginnings of a Rain parser (still using the original occam AST) and its test framework, using HUnit
2007-07-27 15:11:52 +00:00
Neil Brown
fa9c108e50 Added backend-selecting command-line options 2007-07-26 21:18:27 +00:00
Neil Brown
ba60da71d6 Protocol test case expanded
Added larger protocols to stress test the C++CSP backend with variant protocols that have many options, and sequential protocols that have many items
2007-07-26 21:17:27 +00:00
Neil Brown
935d69d544 C++CSP Backend Added
C++CSP backend has been added.  It consists of a support header file and one new Haskell module: GenerateCPPCSP

The module is largely based on GenerateC, changed as needed.  
There is a large section at the bottom of the file with verbatim copy-and-paste from GenerateC,
due to wanting the same functionality, but for calls to use my C++CSP generation not the C generation -- 
hence I cannot simply import those functions.

The backend can generate code for cgtests 0 through 16 (incl) that will compile as valid C++.  The majority of the
tests pass when run (some do segfault, admittedly).  However some arrays still need more testing/work, particularly:
- timers
- array slices
- retyping

The tock_support_cppcsp.h header makes use of tock_support.h, but I had to add a few #ifnders to the latter
file so that I can use it with C++CSP and block out some of the CIF stuff.
2007-07-26 21:11:01 +00:00