Commit Graph

89 Commits

Author SHA1 Message Date
Neil Brown
859a6286ac Added functions to PassList that build a dependency graph from a list of properties (based on their pre- and post- properties) and use it to return an ordered pass list 2008-02-19 09:43:16 +00:00
Neil Brown
cd6e2175f2 Added a new "dump AST" pass 2008-02-14 12:45:11 +00:00
Neil Brown
f17ff5071c Added a Warn monad for warnings, and incorporated a WriterT monad into the PassM stack to support the Warn monad, then changed all the rest of the code accordingly, including adding a Warn instance for the GenParser parser that hides it in the state 2008-02-08 13:22:23 +00:00
Neil Brown
445d45752d Fixed the mode for printing out the flow-graph 2008-02-05 22:36:37 +00:00
Neil Brown
acd57d74de Changed the A.Structured type to be parameterised
This patch is actually an amalgam of multiple (already large) patches.  Those patches conflicted (parameterised Structured vs. changes to usage checking and FlowGraph) and encountered a nasty bug in darcs 1 involving exponential time (see http://wiki.darcs.net/DarcsWiki/ConflictsFAQ for more details).  Reasoning that half an hour (of 100% CPU use) was too long to apply patches, I opted to re-record the parameterised Structured changes as this new large patch.  Here are the commit messages originally used for the patches (which, as mentioned, were already large patches):

A gigantic patch switching all the non-test modules over to using parameterised A.Structured
Changed the FlowGraph module again to handle any sort of Structured you want to pass to it (mainly for testing)
A further gigantic patch changing all the tests to work with the new parameterised Structured
Fixed a nasty bug involving functions being named incorrectly inside transformInputCase
Added a hand-written instance of Data for Structured that allows us to use ext1M properly
Fixed a few warnings in the code
2008-02-05 19:40:27 +00:00
Neil Brown
e94826c64e Added a function to GraphLabelFuncs for labelling replicators 2008-01-30 12:43:28 +00:00
Neil Brown
6a979f3cb1 Added a command-line option for turning on the usage checking 2008-01-29 22:50:51 +00:00
Neil Brown
12b1617fec Added a new labelling function to FlowGraph for labelling the arguments of functions/processes 2008-01-29 20:05:38 +00:00
Neil Brown
5567d8cee0 Changed FlowGraph to keep a record of all the root nodes in the tree and return them in a list 2008-01-29 12:46:14 +00:00
Neil Brown
edc3a7e910 Removed the die function (that has no source position) and as far as possible replaced all its uses with dieP and a valid position 2008-01-28 17:21:13 +00:00
Neil Brown
5988684c00 Moved the Pass list from Main to its own module (PassList) and included the usage-checking pass (when the appropriate option is turned on) 2008-01-16 03:26:20 +00:00
Douglas Warren
7b9789da59 Changed the parse mode to pretty-print the AST by default 2007-11-14 16:26:19 +00:00
Neil Brown
181f7638c4 Changed Main to reflect the changes to the flow-graph builder 2007-11-10 19:10:25 +00:00
Neil Brown
cbc6a70b30 Changed the control-flow graph generation to use the proposed function dictionary, and add the scope-out nodes 2007-10-28 18:26:09 +00:00
Neil Brown
cde83c83ae Added the capability of outputting graphviz scripts representing control-flow graphs 2007-10-28 12:11:27 +00:00
Neil Brown
c19ae03116 Added a pass that changes all C++CSP channels to be of type tockSendableArrayOfBytes, so that the channels can be retyped into each other 2007-10-14 10:28:43 +00:00
Neil Brown
4935a04aa4 Added the simplifyComms pass to the shared pass list for the compiler, and removed the corresponding code in the C backend that the pass replaces 2007-10-11 00:14:27 +00:00
Neil Brown
0bab7f1728 Changed the full compile-mode code, so that temporary files are deleted, even in case of error -- by using some monad trickery. 2007-10-09 00:19:49 +00:00
Neil Brown
6f8aeba867 Made sure that the three temporary files all have different stems, because otherwise there can be collisions between the object files of the C and occam. 2007-10-08 22:32:03 +00:00
Neil Brown
b0f5f6be77 Removed kroc-wrapper.occ, in favour of generating it as a temporary file for each all-in-one compilation 2007-10-08 22:24:02 +00:00
Neil Brown
85fdfe7af7 Added a missing command to actually compile the C file produced by the post-analyse pass, and fixed the file extensions passed to the kroc link command 2007-10-08 21:54:12 +00:00
Neil Brown
c17cf0ce38 Added the first attempt at getting Tock to do an all-in-one compile, from occam/Rain all the way through into an executable binary 2007-10-08 21:18:07 +00:00
Neil Brown
38c409d378 Added the -fwarn-unused-imports compiler option to warn about unused imports, and then set about pruning and ordering (mostly in my code) the import lists for all the modules 2007-09-27 13:13:46 +00:00
Neil Brown
59962ee837 Removed some debug code that was accidentally left in a previous patch 2007-09-18 11:42:00 +00:00
Neil Brown
c97d1d00c8 Changed the error type from String to ErrorReport throughout the code
ErrorReport is of type (Maybe Meta, String), thereby adding an optional code position to error messages.

Die has been changed so that die and dieP are now implemented in terms of dieReport (:: ErrorReport -> m a).  This involved changing less code than changing die to be of type ErrorReport -> m a.  All that had to be changed directly was that Die instances now implement dieReport instead of die.

Any bits of code that "caught" errors has been changed so that it handles ErrorReport instead of String.  This ErrorReport is eventually, in Main, passed to dieIO, which will soon be changed to read the file in and provide the context.  Accordingly, MonadIO m has been added as a constraint to dieIO, and dieInternal has been changed to no longer use dieIO (because really we can't add the MonadIO constraint to dieInternal).

Various error messages have been changed.  Notably, all instances of fail in ParseOccam have been changed to use die or, wherever possible, dieP.  A similar thing has been done in EvalConstants and EvalLiterals.
2007-09-18 10:17:38 +00:00
Neil Brown
2ff46a9041 Rearranged the Rain source files, renamed a couple of Rain files, and changed the Makefile accordingly. 2007-09-10 17:28:57 +00:00
Neil Brown
c09da951f0 Fixed the pass order in the Main module; the rain passes must be performed before the common passes, not afterwards 2007-08-28 15:28:02 +00:00
Adam Sampson
36262fc55e Rework the mechanism that GenerateC uses to get externs from AnalyseAsm.
Neil spotted that I'd broken the C++CSP backend with these changes, and I
wasn't very happy with what I'd done anyway, so this is take 2. Now there's a
separate pass that runs before GenerateC which builds a set of functions used
in PARs.
2007-08-22 22:26:26 +00:00
Adam Sampson
929745f05e Tidy up how Main decides which passes to run.
Since the set of passes that runs now depends on several variables, there's now
an expression which builds a list of passes to run; this should be easier to
extend in the future.
2007-08-22 22:24:08 +00:00
Adam Sampson
da89323dbc Rename Parse to ParseOccam. 2007-08-22 01:59:51 +00:00
Adam Sampson
1bac142a53 Rework the parser to use the new lexer.
The occam parser is now a GenParser Token OccState, rather than a GenParser
Char OccState, and a lot of now-redundant code has been removed. The parser is
also somewhat faster, which wasn't intended but is nice anyway.

I've also modified the Rain parser to not rely on the old preprocessing code;
it wasn't appropriate for Rain's syntax anyway, so I assume Neil will be
replacing it eventually.
2007-08-21 20:44:15 +00:00
Neil Brown
30816b60ac On Adam's suggestion, renamed the occam 2.1 frontend to simply occam 2007-08-20 22:37:21 +00:00
Neil Brown
810dcbfbd9 Added Rain as a possible frontend for Tock, by adding a new command-line option. 2007-08-20 17:39:33 +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
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
Neil Brown
fa9c108e50 Added backend-selecting command-line options 2007-07-26 21:18:27 +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