Commit Graph

35 Commits

Author SHA1 Message Date
Neil Brown
09093cff12 Added the ability to print out HTML-highlighted lexed occam
This falls a bit outside the compiler's remit, but it will be the same code to print out the lexed occam without highlighting, which I plan to use for doing libraries with Tock in a bit.
2009-03-26 22:34:34 +00:00
Neil Brown
633a3dbbc5 Quickly added a command line option to allow you to specify flags to pass to the C/C++ compiler 2009-03-25 22:35:49 +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
5ffea3f78e Added a lex mode to Tock that shows how a program was lexed 2009-03-24 18:18:55 +00:00
Neil Brown
5f9d0c6429 Added various keywords, AST elements and parser bits related to channel bundles, claim blocks and shared channels 2009-03-22 22:49:49 +00:00
Neil Brown
1343954c2f Added an option to automatically run indent on C/C++ source before running GCC
This option is very handy when debugging the C/C++ output of Tock when GCC gives a compiler error.
2009-03-21 18:25:09 +00:00
Neil Brown
b970b9df33 Added command line options for occam 2 mobility, and turned it off by default 2009-03-19 11:38:48 +00:00
Neil Brown
823592bd1d Added some passes to mobilise non-mobile arrays 2009-02-27 17:12:08 +00:00
Neil Brown
81959bd76b Added quick preliminary support for the PERMITALIASES pragma 2009-02-10 01:01:23 +00:00
Neil Brown
8a28d765e7 Implemented recursive procs
This works fine in the C++ backend, not tested with the C backend yet
2009-01-29 00:43:24 +00:00
Neil Brown
52459e7557 Turned on usage checking by default
I think the Tock usage checking is now sufficiently advanced (it only rejects one or two parts of the cgtest at the moment) to turn it on by default
2009-01-28 17:34:34 +00:00
Neil Brown
f612b99a49 Added a map of name attributes (ready for things like PRAGMA SHARED) to the CompState
This should possibly (and could in future) be combined into NameDef and the main csNames map
2009-01-19 15:10:05 +00:00
Neil Brown
0a98db5295 Changed pshow on CompState (which caused errors) to plain show, by adding a Show instance to CompState 2009-01-15 20:59:37 +00:00
Neil Brown
46a1cc311f Moved a couple of fields related to Rain type checking out of CompState and into a temporary StateT monad for the appropriate pass 2008-12-02 20:59:26 +00:00
Neil Brown
0e7a6c5b98 Added a NameSource field for NameDef that indicates where a name comes from 2008-11-25 17:36:42 +00:00
Neil Brown
6cbdc0e13b Finally merged the list of warnings into CompState rather than having its own StateT monad 2008-11-20 13:35:44 +00:00
Neil Brown
f88c671cf7 Added a set of enabled warnings to CompState 2008-11-20 13:17:05 +00:00
Neil Brown
0d486f108f Added a value to indicate what type a warning is (to support future configurability) and streamlined the warning functions 2008-11-13 15:36:22 +00:00
Adam Sampson
cf79f9c284 Get rid of the nasty ghost names hack.
Rather than prefixing the names, there's now a set of ghost names in
CompState.

Fixes #66.
2008-06-02 10:58:26 +00:00
Adam Sampson
36e7353ee7 Take NameType out of NameDef.
NameType is only really needed in the parser, so this takes it out of
NameDef, meaning that later passes defining names no longer need to
set an arbitrary NameType for them. The parser gets slightly more
complicated (because some productions now have to return a SpecType
and a NameType too), but lots of other code gets simpler.

The code that removed free names was the only thing outside the parser
using NameType, and it now makes a more sensible decision based on the
SpecType. Since unscoped names previously didn't have a SpecType at
all, I've added an Unscoped constructor to it and arranged matters
such that unscoped names now get a proper entry in csNames.

Fixes #61.
2008-06-02 10:13:14 +00:00
Neil Brown
d044b51335 Renamed ndType to ndSpecType, as per Trac ticket #59 2008-05-21 13:38:51 +00:00
Neil Brown
90986ea97b Added a backend that prints out the AST as source (rather than dumping the raw AST) 2008-05-17 22:20:38 +00:00
Neil Brown
ab0301a342 Made the Rain parser actually record an unknown (to-be-inferred) type for numeric literals 2008-05-17 14:24:45 +00:00
Neil Brown
f10cb7d525 Moved the TypeExp type out to its own module, UnifyType 2008-05-17 14:21:57 +00:00
Neil Brown
f8b7e8f8cb Added unifying-related items to CompState, and changed all the uses of ST to IO in the TypeUnification module
As part of this patch I also had to provide a Data instance for TypeExp (to allow CompState to still be an instance of Data).  Using IORefs is easier than STRef RealWorld, and puts everything in terms of IO (which is already in PassM) rather than ST (which would require more lifting).
2008-05-17 12:50:52 +00:00
Adam Sampson
710be039cb Have the pregen programs figure out the types using generics.
Previously they had a list of the types they needed to generate
instances for.  This patch adds some helper code that can be used to
list all the AST.* types in the AST automatically. The result is that we
should be able to add new types to the AST without needing to change the
generator code.

This also means that GenOrdAST is now generating *all* the instances of
Ord for the AST; previously the trivial ones were derived by the
compiler.
2008-05-09 14:02:13 +00:00
Adam Sampson
8cedbed5fc Move makeUniqueName and findUnscopedName into CompState. 2008-04-06 17:42:12 +00:00
Adam Sampson
249fd23e75 The type context is now used by passes, not the parser. 2008-04-06 02:59:34 +00:00
Neil Brown
cbbafffbd2 Changed Rain to use the new timer type rather than things like the GetTime statement 2008-03-24 13:50:14 +00:00
Neil Brown
7f28d3dbe3 Added a warnPC function (like diePC) for use with formatCode 2008-03-22 18:34:40 +00:00
Adam Sampson
3005dfb506 Add a pass for folding constants in occam.
The existing constant-folding code in the parser is still there, since it needs
to know whether things are constant, and A.Dimension expects an Int.

However, this pass is useful because it does a better job of constant folding
than the parser would on its own: it can fold subexpressions of expressions
that are as a whole not constant.
2008-03-17 15:48:43 +00:00
Neil Brown
ba75f5b06c Removed the initialiser expression on the Declaration item in the AST 2008-03-09 00:23:13 +00:00
Adam Sampson
8f2575819b Initial implementation of the occam-pi preprocessor.
This implements #DEFINE, #UNDEF, #IF, #ELSE and #ENDIF, macro expansion with
##, and TRUE, FALSE, AND, OR, NOT and DEFINED within #IF expressions, with the
same semantics as occ21.

The macro COMPILER.TOCK is always defined by default, so you can now say things
like "#IF NOT DEFINED (COMPILER.TOCK) ... #ENDIF".
2008-02-28 20:27:30 +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
decf249c51 Moved AST, CompState and Metadata out to a new data directory (along with the generated OrdAST and TagAST) 2008-02-26 15:02:13 +00:00