Commit Graph

340 Commits

Author SHA1 Message Date
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
Neil Brown
33e3123148 Minor Haddock-related fixes
Fixes a few minor things in the code that were confusing the Haddock parser during "make haddock"
2007-07-25 14:00:48 +00:00
Adam Sampson
c33dff1398 Add Makefile rule to get cgtests 2007-07-16 21:54:46 +00:00
Adam Sampson
50731d0b75 Give tock its own repo -- i.e. remove everything else and move tock up 2007-07-16 21:48:55 +00:00
Adam Sampson
bf1a0392d5 Reinstate inline support, and tweak GCC options 2007-07-06 17:05:28 +00:00
Adam Sampson
a34213b07b Add another to-do 2007-05-24 16:26:08 +00:00
Adam Sampson
0a4e28a585 Add a "Hello, world" demo 2007-05-16 23:35:16 +00:00
Adam Sampson
a75ac6a455 Wholesale rename: ParseState is now CompState 2007-05-16 23:31:44 +00:00
Adam Sampson
e4125e768b Fix literal typechecking for user types 2007-05-16 22:09:45 +00:00
Adam Sampson
5c0a152320 Make Show Type produce occam-looking types, for nicer error messages 2007-05-16 21:15:05 +00:00
Adam Sampson
b6537890e0 Helper function for "sequence_ $ intersperse genComma" 2007-05-16 19:39:04 +00:00
Adam Sampson
d5766c5fe5 Implement arrays inside records.
... which required a bunch of stuff:

- Record handling in the literal evaluator (to solve a nasty problem with
  record literals documented in the code).

- Splitting abbrevModeOfVariable into two functions which do the two
  (different) things it was previously used for.

- Clean up how arrays are handled in GenerateC.

- Fix the pullup rules for record literals containing arrays.
2007-05-16 19:34:10 +00:00
Adam Sampson
b2fb4ee22f Fix a record literal parsing bug (where array type folding confused it) 2007-05-11 02:03:26 +00:00
Adam Sampson
0337cf842f Constant-fold table elements 2007-05-11 01:58:34 +00:00
Adam Sampson
95cc912a2d Remove debugging 2007-05-11 01:58:24 +00:00
Adam Sampson
a8f0fc2caa Implement record literals 2007-05-05 00:26:26 +00:00
Adam Sampson
95d366ff40 Tidy up literal typing 2007-05-04 01:14:01 +00:00
Adam Sampson
afdd2c88e7 Fix parsing of field names 2007-05-03 23:15:24 +00:00
Adam Sampson
6a30c57f52 Resolve named types when checking conversions 2007-05-03 23:13:23 +00:00
Adam Sampson
4551d97b28 Make unsubscriptType produce the right types for slices 2007-05-03 20:21:19 +00:00
Adam Sampson
ed847a1ea9 Do array assignment check at runtime, and produce better metadata 2007-05-03 18:07:22 +00:00
Adam Sampson
a17ee03393 Rework how array contexts are handled in actuals 2007-05-03 17:44:26 +00:00
Adam Sampson
c6e062cde0 Resolve user types for subscripts and case selectors 2007-05-03 03:53:06 +00:00
Adam Sampson
47ecfd5670 Make the constant folder (minimally) aware of named types 2007-05-03 03:38:32 +00:00
Adam Sampson
043e8e1114 Recurse into array types 2007-05-03 03:38:25 +00:00
Adam Sampson
de36b66c8d Handle the Map types in ParseState 2007-05-03 03:31:09 +00:00
Adam Sampson
f84ce0e5c2 Allow empty formal lists too 2007-05-03 03:11:55 +00:00
Adam Sampson
4b0e02a4ce Apply dimensions to string literals too 2007-05-03 03:10:20 +00:00
Adam Sampson
0c1413c8da Fix formal parsing 2007-05-03 02:58:17 +00:00
Adam Sampson
3d897a70fd Rework (but don't yet fix) formalArgSet 2007-05-03 02:43:01 +00:00
Adam Sampson
200619042d Implement user datatypes 2007-05-03 02:17:53 +00:00
Adam Sampson
4d9c4176a8 Don't pull named types 2007-05-03 00:11:11 +00:00
Adam Sampson
0271fbc1d7 Add some bad retype testcases 2007-05-03 00:09:20 +00:00
Adam Sampson
ff3bd7fd71 Split UserDataType and Record 2007-05-02 23:44:27 +00:00
Adam Sampson
5480262836 Allow genBytesIn' of channels 2007-05-02 22:13:29 +00:00
Adam Sampson
db79a4f3e6 Prune traversals of the AST (speeds up from 90s to 20s for ats1-q7) 2007-05-02 21:51:35 +00:00
Adam Sampson
a90fefefb2 Use Maps for things that should be maps 2007-05-02 20:14:44 +00:00
Adam Sampson
c55137c7f4 Better runtime checks for RETYPEs 2007-05-02 14:22:56 +00:00
Adam Sampson
13dccaba4d Fix "? CASE tag" parsing in ALTs 2007-05-02 13:18:41 +00:00