Commit Graph

2343 Commits

Author SHA1 Message Date
Neil Brown
1bf3f6f0f1 Fixed the type of a function name in buildExpr to fix the tests 2008-03-23 12:08:08 +00:00
Neil Brown
0ed18c933f Fixed pullUp to not pull up list expressions
This patch looks like I removed the wrong line above, but it was identical to the line I actually removed, so the patch is fine, it just looks odd.
2008-03-23 11:49:42 +00:00
Neil Brown
c1479bc1a8 Fixed the list of excluded Rain things by removing IntrinsicFunctionCall from the list 2008-03-23 11:48:33 +00:00
Neil Brown
1650d55d4e Added the functionTypesChecked property to the dummy occam pass 2008-03-23 11:47:59 +00:00
Neil Brown
78c2160eb4 Fixed the type of a function name to avoid confusing the pass to remove free names later on 2008-03-23 00:11:11 +00:00
Neil Brown
dd7b0268b2 Added a new property (functionTypesChecked) to help fix the pass ordering 2008-03-23 00:09:01 +00:00
Neil Brown
4e9a00a5b7 Added support for for-each replicators to the freeNamesIn function 2008-03-23 00:08:48 +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
7a7b60449c Enhanced an error message in RainTypes 2008-03-22 19:04:34 +00:00
Neil Brown
e767e33190 Added support for some intrinsic (time-related) functions in Rain 2008-03-22 18:58:10 +00:00
Neil Brown
230db2de08 Added support for specifications at the start of functions without ruining the check for a return statement 2008-03-22 18:57:23 +00:00
Neil Brown
7f28d3dbe3 Added a warnPC function (like diePC) for use with formatCode 2008-03-22 18:34:40 +00:00
Neil Brown
ae142a94e1 Added support for uniquifying function arguments to the Rain passes 2008-03-22 18:34:07 +00:00
Neil Brown
81c342156d Fixed Rain commstime some more 2008-03-22 18:33:43 +00:00
Neil Brown
813d6affd1 Fixed an error message in RainTypes 2008-03-22 18:02:43 +00:00
Neil Brown
b1f962d7c2 Added a couple of missing semi-colons to a Rain testcase 2008-03-22 17:50:12 +00:00
Neil Brown
710abd7019 Added support for function calls to the Rain parser 2008-03-22 17:49:21 +00:00
Neil Brown
f680799363 Added more Rain testcases to the repository 2008-03-22 16:11:12 +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
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
Adam Sampson
321e52dd65 Add checkDepthM.
This is like applyDepthM, but for functions that don't want to change the AST.
(There's probably a more efficient way of implementing this.)
2008-03-22 00:45:40 +00:00
Adam Sampson
8b2568264d Add more utility functions along the lines of defineConst.
These let you define various sorts of name in the initial state of a pass test.
2008-03-22 00:44:57 +00:00
Adam Sampson
8b5233ba47 Add ShowCode instances for A.Name. 2008-03-22 00:42:00 +00:00
Adam Sampson
e23a12c71d Don't resolve user types until after type checking.
This is important -- a user type defined as INT in occam must not be treated
the same as INT when typechecking.
2008-03-22 00:12:54 +00:00
Adam Sampson
9cea36257e Make functionsToProcs depend on expressionTypesChecked.
I think in general typechecking needs to happen before any other pass runs,
else the user's likely to get rather confusing error messages.
2008-03-22 00:04:53 +00:00
Adam Sampson
cfc5b18e3e Don't show the state when a pass unexpectedly succeeds.
This used not to be a problem, but there's now quite a lot of stuff predefined
in the state when testing the typechecker, so it tends to obscure the real
error...
2008-03-20 23:56:13 +00:00
Adam Sampson
7c4275116e Various cleanups to AST.hs.
No code changes; just reformatting.
2008-03-20 22:18:32 +00:00
Neil Brown
025eebf61d Added support for giving ranges an explicit type in Rain 2008-03-21 21:10:47 +00:00
Neil Brown
0511c852da Added a couple of reminders to RainPassesTest 2008-03-21 20:16:48 +00:00
Neil Brown
2189a6c28a Added support for list literals to the Rain parser 2008-03-21 20:03:47 +00:00
Neil Brown
f7141bda6f Corrected transformConstr0 2008-03-21 20:02:33 +00:00
Neil Brown
14e375247c Added an error message to transformConstr for when the type is not supported 2008-03-21 19:32:07 +00:00
Neil Brown
fe24c5cfb4 Corrected some test numbering in ParseRainTest 2008-03-21 19:25:19 +00:00
Neil Brown
7bd5bdf1fa Changed a Rain pass to transform the Plus operator on lists into the proper Concat operator 2008-03-21 19:23:16 +00:00
Neil Brown
cfccd38c51 Changed transformConstr to transform list-typed array constructors to build up a list rather than subscripting it 2008-03-21 19:22:29 +00:00
Neil Brown
a1daf15576 Pulled up list expressions in a similar way to array expressions 2008-03-21 19:21:46 +00:00
Neil Brown
bc7e682119 Added a Concat operator for lists, and added support for it (and list assignment) to the backends 2008-03-21 19:20:15 +00:00
Neil Brown
da5801ad03 Refactored transformConstr to pull out some of its working into helper functions 2008-03-21 19:13:54 +00:00
Neil Brown
80ffc87f94 Added a newline at the end of the generated C++ files 2008-03-21 18:47:09 +00:00
Neil Brown
ebef4aaedf Fixed array constructors by adding an occam pass to figure out their type early on, and also corrected the ordering of the later passes 2008-03-21 18:23:42 +00:00
Neil Brown
8db5975671 Refactored checkExpressionTypes a little 2008-03-21 16:35:57 +00:00
Neil Brown
3fede166f6 Added another Rain testcase 2008-03-21 16:35:21 +00:00
Neil Brown
33b04e7646 Tidied up a few unused functions and module imports 2008-03-21 15:16:36 +00:00
Neil Brown
0dc458ff03 Fixed transformEachRange to change the abbreviation mode of the loop counter 2008-03-21 15:09:00 +00:00
Neil Brown
dfea2c11a5 Added a dummy Rain pass to supply the new retypesChecked property 2008-03-21 15:07:56 +00:00
Neil Brown
142926172d Fixed the error message given when there is a problem with the pass dependency graph 2008-03-21 14:51:54 +00:00
Neil Brown
273aeead4e Added the code to guess the frontend based on the file extension (.occ/.rain) 2008-03-21 14:46:28 +00:00