Commit Graph

55 Commits

Author SHA1 Message Date
Neil Brown
4ef1ff7196 Changed to a state monad for warnings, and added a runPassM function to remove duplicate code for running passes 2008-04-03 12:21:59 +00:00
Neil Brown
463ddc636b Changed the running of the PassM monad to use the new mechanism 2008-03-10 15:19:50 +00:00
Neil Brown
d66fb79796 Fixed some unused module import warnings, now that PassM is not build of monad transformers 2008-03-10 17:19:45 +00:00
Neil Brown
5e70e70d95 Added support for automatically inducing the output file from the input file for full compile mode (filename minus extension) 2008-03-25 11:46:10 +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
Neil Brown
c778ff0031 Fixed some unused module import warnings, now that PassM is not build of monad transformers 2008-03-10 17:19:45 +00:00
Neil Brown
a123981a74 Changed the running of the PassM monad to use the new mechanism 2008-03-10 15:19:50 +00:00
Neil Brown
ba9ac70d7c Changed the C and C++ backends to write directly to the output file, to save building up the strings in memory 2008-03-08 14:10:05 +00:00
Neil Brown
edefe7be9f Added a progress message just before the backend is entered 2008-03-06 15:23:31 +00:00
Adam Sampson
aff90d8d45 Some initial shuffling to get Tock working with the new CIF.
This changes the TLP code to use CCSP's stand-alone mode, and gets rid of the
old KRoC wrapper stuff. It also changes occam_stop everywhere in order to pass
the number of arguments (since ExternalCallN needs that now), and cleans up the
interaction with the C++ backend a bit.
2008-03-05 16:21:20 +00:00
Adam Sampson
168628576d Rework how temporary files are named.
The temporary files used during compilation are now just the output name with
an appropriate extension added (so when compiling to cgtest02, it'll produce
cgtest02.cpp, etc.). This is what GCC and KRoC do; it keeps the temp files with
the binaries that were produced from them, and avoids having to pick a sensible
directory to put randomly-named temp files in.
2008-02-29 22:53:45 +00:00
Adam Sampson
d048a0ef71 Clean up Main.hs.
This particular file was badly in need of some love, being some of the first
code I wrote on Tock, and thus being a mix of my early style, my late style,
and Neil's style. I've cleaned it up quite a bit, fixing whitespace damage and
dodgy indentation, and making sure lists are alphabetised.
2008-02-29 22:06:37 +00:00
Neil Brown
4a0d199406 Fixed the keep temporaries thing so that it still keeps them when the compilation succeeds, not just when it dies 2008-02-27 19:58:32 +00:00
Neil Brown
eef0ac53e0 Added a flag to the compiler to tell let it to not delete the temporary files it used 2008-02-27 18:23:22 +00:00
Neil Brown
062cd0415a Added a simple (-h/--help) option for printing the Tock help 2008-02-24 12:15:39 +00:00
Neil Brown
6d9534f9b9 Made running the properties configurable by a --sanity-check command-line option 2008-02-24 12:15:02 +00:00
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