Commit Graph

480 Commits

Author SHA1 Message Date
Neil Brown
aa7d6b9b44 Added a function for testing that defines all the occam built-in operators, which helped fix all the failures in OccamPasses 2009-04-18 18:09:20 +00:00
Neil Brown
46b1b29e12 Moved some of the operators stuff out into its own module, and corrected ShowCode to display operators nicely 2009-04-18 21:03:12 +00:00
Neil Brown
f4ed82d8f4 Added back a line to Types that I recently removed, but which turns out to be needed 2009-04-18 20:08:09 +00:00
Neil Brown
307b0f906f Added some missing bits to ShowCode 2009-04-18 20:07:58 +00:00
Neil Brown
57ffc7bfa4 Split out a chunk of CompState into a CompOpts type for things that can be set on the command-line 2009-04-17 21:10:14 +00:00
Neil Brown
378ef07893 Adjusted all the other modules to reflect the new change to CSM 2009-04-17 17:40:00 +00:00
Neil Brown
f36543d067 Fixed the dereference-inference for mobiles
The new system works by inserting code in the processing of all AST elements that directly contain a variable.  If the variable needs to be dereferenced, it is.  This only happens outside variables, and when a variable is subscripted.  I did try putting this processing in doVariable, but then odd double-dereferences began to crop up, so I realised the processing has to happen outside the variable.  It seems to pass cgtest85 fine, which it was having lots of trouble with before.
2009-04-17 11:46:00 +00:00
Neil Brown
3a2182326c Added a new function in Utils for splitting a file into its extension, and the rest of it 2009-04-14 16:58:38 +00:00
Neil Brown
d2260e1736 Added a new function to Utils, and made one of the existing functions simpler and more efficient 2009-04-14 12:07:12 +00:00
Neil Brown
f257100ba8 Added support for the SETPRI intrinsic 2009-04-14 11:05:27 +00:00
Neil Brown
04974ae470 Fixed various typing problems involving channel bundles 2009-04-13 19:20:15 +00:00
Neil Brown
e409b15b58 Merged latest patches from trunk into Polyplate 2009-04-13 16:58:07 +00:00
Neil Brown
d4a119ecf4 Added lexing, parsing and type-checking support for FORKING and FORK 2009-04-13 14:57:03 +00:00
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
8f767ff0d4 Made all the imports of Data.Generics have an import list
This makes sure that we catch all leftover instances of using SYB to do generic operations that we should be using Polyplate for instead.  Most modules should only import Data, and possibly Typeable.
2009-04-09 15:36:37 +00:00
Neil Brown
e61a23855a Fixed all the conflicts while merging into the Polyplate branch 2009-04-09 11:01:39 +00:00
Neil Brown
c69ea8815d Merged in the latest changes from the trunk into the Polyplate branch 2009-02-03 13:14:07 +00:00
Neil Brown
4672675ba8 Removed the GenericUtils module, now that everything uses Polyplate instead 2009-01-12 18:03:41 +00:00
Neil Brown
1d500b46ae Moved the SYB-based route stuff back into FlowUtils, and trimmed down the export list of GenericUtils 2008-12-15 10:36:48 +00:00
Neil Brown
b94091a08c Moved all of the Route stuff out into a new polyplate module 2008-12-14 22:47:07 +00:00
Neil Brown
92035a82a2 Got the test utilities working with the new Pass type synonym 2008-12-14 19:00:19 +00:00
Neil Brown
560b67de5e Added a missing case in showOccamM for A.Type 2008-12-14 18:26:10 +00:00
Neil Brown
f29d0993e9 Added a list replace function to the Utils module 2008-11-26 15:11:26 +00:00
Neil Brown
890e7ea9a6 Fixed many of the modules to use the new Polyplate-based Traversal system 2008-12-02 18:06:10 +00:00
Neil Brown
5534d1c3d6 Fixed some problems with DATA TYPEs that were actually MOBILE stuff not being resolved at the right points 2009-04-12 13:50:59 +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
e53da5822f Fixed a problem where operators with % in the name were screwing up an error message 2009-04-10 16:06:49 +00:00
Neil Brown
92c92a3f65 Fixed various small mobile typing issues 2009-04-09 17:05:16 +00:00
Neil Brown
229f2197af Turned findMeta into a member of a FindMeta type-class 2009-04-09 11:13:37 +00:00
Neil Brown
998cf1c005 Fixed various bits of type-inference in OccamTypes 2009-04-09 10:00:03 +00:00
Neil Brown
de097bb138 Fixed type-checking on ambigious record fields, so that now the cgtests are happy again 2009-04-08 19:11:33 +00:00
Neil Brown
82be1bd726 Also fixed the types of the ..TOSTRING procs in the occam intrinsic list in Tock 2009-04-08 19:10:46 +00:00
Neil Brown
6814ac2679 Added a joinWith helper (short for concat . intersperse) and changed most of the uses in the code to use the helper function 2009-04-08 16:28:23 +00:00
Neil Brown
5c353f10b7 A big patch to get ArrayUsageCheck compiling again, with the new operators 2009-04-08 15:44:35 +00:00
Neil Brown
d2fb80c516 Added a foldM1 function to the Utils module 2009-04-08 15:33:36 +00:00
Neil Brown
009cf8cc8b Added a helper function like functionOperator, but that only gives back a Just result if the operator is a non-overridden version 2009-04-08 15:15:47 +00:00
Neil Brown
1ea35c6715 Fixed the name munging for declared user-defined operators 2009-04-08 12:14:05 +00:00
Neil Brown
d782c91ed0 Added some missing occam operators to the various lists 2009-04-08 12:03:48 +00:00
Neil Brown
29a41fce72 Fixed the Check module to generates its BK based on the new operators-as-functions system -- it now compiles, but I haven't tested it thoroughly 2009-04-08 12:03:39 +00:00
Neil Brown
22cb9d35b6 Fixed the constant folding to understand the new operators-as-functions system, and only fold when the original built-in definition is being used 2009-04-08 10:28:26 +00:00
Neil Brown
26be673ce1 Made sure that user-defined types are resolved before looking for matching operator definitions 2009-04-08 10:18:14 +00:00
Neil Brown
62dfdec9ab Added a translation routine to the Types module to turn occam operators into C-friendly names 2009-04-07 16:12:37 +00:00
Neil Brown
0a67b804bb Added more intrinsically-defined operators to the list 2009-04-07 16:01:44 +00:00
Neil Brown
f7e114f2fd Overhauled the Types module and ParseOccam to support the new system of operators-as-functions
The idea behind this is to parse unary/binary operators into function calls with 1/2 operands.  So the AST actually has a FunctionCall with the name "+".  Function names may now be quoted operators, and thus you can also have function declarations with names such as "+".  Resolving is *not* done in the parser for these function names, but rather every "+" is left as "+" (no matter what types it operates on, or what is in scope) by the parser (see later patches to InferTypes instead).

When parsing an occam source file, we automatically insert a bunch of PRAGMA TOCKEXTERNAL that define the default occam operators (e.g. + on INT) as external C functions (which they are!).  The naming scheme for these C functions is standardised, and must be used by functions such as mulExprs (which bases the function on the type of its operands) and the new versions mulExprsInt (which are pegged to INT).

The Types module also has some new functions for dealing with operator-functions.
2009-04-05 22:54:05 +00:00
Neil Brown
cd0dd96939 Added some code to the Intrinsics module to list all (currently only some) of the occam standard operators with the types they can operate on 2009-04-05 22:48:23 +00:00
Neil Brown
238abc5070 Removed all the stuff from the ShowCode module that used to deal with operators 2009-04-05 22:38:00 +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
11cc8c92a7 Corrected a small warning in PrettyShow 2009-04-04 12:49:01 +00:00
Neil Brown
9fbbe87fd4 Fixed the reading of floating point literals to work for negative numbers 2009-04-03 17:53:10 +00:00
Neil Brown
b9cbcf0902 Added the intrinsic CAUSEERROR 2009-04-03 15:14:24 +00:00