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
Neil Brown
5024e0d615
Fixed the generation of formals that are arrays of channel-ends
2009-04-02 15:58:35 +00:00
Neil Brown
1e538fc592
Fixed ShowCode to print direction specifiers in the right place after variable names, as it's important now that what we spit out for PROC headers is legitimate occam
2009-04-01 17:08:04 +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
2edf5cc43d
Fixed constant folding to resolve any user types involved
...
Due to awkward module dependencies, some functions had to be moved around to accommodate this change. Two from Types have gone to EvalLiterals, and two to CompState. Everything still compiles just as before though.
2009-03-31 16:11:00 +00:00
Neil Brown
dbf886996a
Removed various bits of old code relating to the old sizes mechanism
2009-03-31 10:50:04 +00:00
Neil Brown
3876c1b6e9
Added support for VariableSizes to the ShowCode module
2009-03-30 15:33:10 +00:00
Neil Brown
c1c73f9186
Added constant-folding support for VariableSizes
2009-03-30 15:32:38 +00:00
Neil Brown
1144975abc
Added support for VariableSizes to the Types module, including a helper function: specificDimSize
2009-03-30 15:30:46 +00:00
Neil Brown
676bbe34d4
Added a few missing lines in the constant folding
2009-03-27 21:40:14 +00:00
Neil Brown
d35825ec50
Added support for constant-folding reals, and for constant-folding RETYPES
2009-03-26 18:33:14 +00:00
Neil Brown
96984250b7
Added some missing cases to the ShowCode module
2009-03-26 18:30:30 +00:00
Neil Brown
45b22472c3
Changed the rest of tock to reflect the changes to the Is constructor
2009-03-24 23:57:24 +00:00
Neil Brown
34ae9861d0
Marked up channel bundles as being mobile
2009-03-23 21:12:36 +00:00
Neil Brown
78f9fb6196
Added support in recordFields for channel bundles (which are similar enough to records)
2009-03-23 18:59:41 +00:00
Neil Brown
04108613d9
Added support to a couple of functions for the IsClaimed SpecType
2009-03-23 18:56:48 +00:00
Neil Brown
41805aaacf
Changed the ChanEnd constructor to only keep information about its shared-ness, not about the whole channel
2009-03-23 18:40:28 +00:00
Neil Brown
8af024e08d
Fixed a ShowCode comment and added a missing case
2009-03-23 15:55:15 +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
0a97946fbf
Fixed various type-checking things related to mobile types
2009-03-22 21:05:36 +00:00
Neil Brown
4f6050069c
Moved isMobileType into the Types module where it belongs
2009-03-22 18:26:14 +00:00
Neil Brown
03f1b2d115
Added a few more mobile things (DEFINED keyword, an intrinsic)
2009-03-20 20:53:51 +00:00
Neil Brown
3a7b2aaaf4
Added a function for getting the attributes of a record type
2009-03-20 19:10:11 +00:00
Neil Brown
1044a94730
Changed most of the rest of Tock (except some tests) to understand the new record attributes
2009-03-20 15:18:29 +00:00
Neil Brown
65550b705e
Added an AllSizesVariable item to the AST so that the backend inserts the right code for mobiles and non-mobiles
2009-03-20 11:31:14 +00:00
Neil Brown
65875f523f
Added mobile cloning rather than using dereferencing to copy mobiles
2009-03-19 16:47:31 +00:00
Neil Brown
8e5e73e3a2
Fixed the support in the backends for mobile channel stuff
2009-03-19 15:23:35 +00:00
Neil Brown
ca61da25cf
Added a function to the Types module to allow you to easily change the type of a SpecType
2009-03-19 15:13:00 +00:00
Neil Brown
0d5c8f28fd
Fixed a couple of helper functions to navigate through mobile arrays properly
2009-02-27 17:09:14 +00:00
Neil Brown
2a2ce367ca
Added some missing cases in the ShowCode module
2009-02-27 17:02:34 +00:00
Neil Brown
4055746e19
Fixed typeOfVariable to handle directed inferred variables
2009-02-10 22:20:02 +00:00
Neil Brown
24fa36ccda
Modified the test harness so that it gives a meta tag on failure (in case we want it)
2009-02-10 21:33:53 +00:00
Neil Brown
93af6b85a4
Updated the comments on the product* functions in the Utils module
2009-02-09 23:10:29 +00:00
Neil Brown
0e95d5d15e
Added a couple more functions to the Utils module
2009-02-09 22:25:12 +00:00
Neil Brown
904b913ebd
Added another helper function to the Utils module
2009-02-09 16:57:02 +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
091acfa848
Added a new helper function to Utils for joining pairs of lists with pairs of lists
2009-02-07 18:45:56 +00:00
Neil Brown
56a10b403f
Added a new function, filterMapByKey, to the Utils module
2009-02-05 15:52:43 +00:00
Neil Brown
bb6937433f
Fixed the TestUtils module by removing some of the old range stuff
2009-02-03 11:52:12 +00:00
Neil Brown
ec1341849d
Added a ShowOccam instance for A.Dimension
2009-02-02 23:51:15 +00:00
Neil Brown
8de2dbca88
Adjusted the modules in common to match the new array constructor change
2009-02-01 21:52:13 +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