Adam Sampson
a9f1e52103
Structure analyser for the new lexer.
2007-08-20 00:48:55 +00:00
Adam Sampson
543a7b6872
Add a first shot at a lexer for occam.
...
The aim is to separate lexing from the existing parser, which should make
indentation processing a good deal less painful.
The lexer is compiled using Alex, which generates Haskell code from the .x
file; it's not particularly elegant but the input syntax is nice and it does
seem to work well.
2007-08-19 20:21:40 +00:00
Adam Sampson
65d5fc450d
Remove readSource in favour of readFile.
...
It turns out there's a Prelude function that does what readSource does already
-- so just use that. (I was in the process of moving readSource into Utils when
I found it, since I want to use it in other places.)
2007-08-19 18:21:23 +00:00
Adam Sampson
c8d5a4ff40
Add licensing information.
...
The compiler itself is under the GPLv2+; the support code that gets built into
user programs is under the LGPLv2+. This matches the existing practice for the
KRoC project.
(As with Occade, I've used the new GPLv3-style license header in the source
files, though, since that avoids having to update the FSF's postal address.)
2007-08-18 20:42:11 +00:00
Neil Brown
f9a811e775
Rain: implemented the pass for recording inferred types, and added one more test for it
2007-08-18 18:10:51 +00:00
Neil Brown
3473c512a3
Rain: Added a helper function to the pass tests for tests that are expected to fail
2007-08-18 18:10:09 +00:00
Neil Brown
3f84532695
Renamed the old pass that recorded declared types, added a new skeleton pass for recording inferred types, and wrote some tests for this new pass
2007-08-18 17:33:40 +00:00
Neil Brown
b9c12a0b22
Rain: refactored the tests, pulling out some common functionality
2007-08-18 17:32:41 +00:00
Neil Brown
88380cdc6f
Rain: implemented the pass to record the type of names in CompState
2007-08-18 17:05:08 +00:00
Neil Brown
bc24ba16b1
Rain: added a skeleton pass for recording type names in CompState, and wrote a test for it
2007-08-18 16:56:25 +00:00
Neil Brown
d7dc28ce47
Rain: generalised part of the test framework and added a new helper function for testing passes
2007-08-18 16:55:20 +00:00
Neil Brown
dcfd23db4f
Rain: expanding the unique-name pass to also resolve inner variables, and changed the tests accordingly
2007-08-18 16:03:19 +00:00
Neil Brown
34eac44d45
Rain: implemented the pass to give declarations unique names
2007-08-18 15:48:22 +00:00
Neil Brown
9d9b6dd73f
Rain: added a skeleton pass for giving variables unique names, and wrote tests for it
2007-08-18 15:39:39 +00:00
Neil Brown
f732996c13
Rain: added various helper functions to RainPassTest
2007-08-18 15:38:43 +00:00
Neil Brown
f700392676
Added a useful transformEither function to Utils
2007-08-18 15:37:29 +00:00
Neil Brown
68a3b3f4bc
Tidied up some test functions and added assertNotEqual function
2007-08-18 14:48:23 +00:00
Neil Brown
8ab4299553
Refactored TreeUtil to provide Show and Eq instances for AnyDataItem, which allowed other functions to be simplified/removed
2007-08-18 14:46:57 +00:00
Neil Brown
fe5141d310
Changed the Either order in TreeUtil of getMatchedItems to match Haskell convention
2007-08-18 11:09:37 +00:00
Neil Brown
7b81208794
Rain: refactored the pass tests to remove duplicate code
2007-08-18 10:59:00 +00:00
Neil Brown
3cb1a942f4
Rain: tidied up the types of the each tests slightly
2007-08-18 10:36:04 +00:00
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