Commit Graph

13 Commits

Author SHA1 Message Date
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
72fe41cdc1 Added a couple of missing cases to isExempt (in the abbreviation checking) 2009-03-31 09:20:01 +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
81ebebe4fe Added a quick work-around in SimplifyAbbrevs for the SYB-Map issue 2009-03-22 00:32:56 +00:00
Neil Brown
6d112a244e Fixed when names are exempted from abbreviation checking by the PERMITALIASES pragma 2009-02-11 13:15:25 +00:00
Neil Brown
152f5fc252 Changed the abbreviation checking so that it doesn't check nonce names
When we pull up names (which happens before abbreviation checking), we create a lot of nonces with greater scope than the original variables.  When we go to abbreviation check this, we therefore set off lots of false alarms about originally safe code.  So to fix this, the easiest method seems to be turning off checking on all the names introduced by the compiler.
2009-02-11 11:23:39 +00:00
Neil Brown
e37fa37c79 Recoded abbrevCheckPass so that it is much more efficient (now does everything in one pass of the AST) 2009-02-10 13:14:45 +00:00
Neil Brown
9d44e3475c Swapped some uses of listify to fastListify, but the abbreviation checking is still very slow 2009-02-10 12:49:54 +00:00
Neil Brown
bcd670bfd2 Fixed a couple of problems with the usage checking 2009-02-10 12:40:24 +00:00
Neil Brown
cff10e2f28 Added a pass that checks that abbreviations are used properly 2009-02-10 11:32:10 +00:00
Adam Sampson
02c444be95 Update abbrevation types in the state too.
This makes cgtest82 work, although I'm not very happy with it as a fix. I'd
rather have a way of ensuring the state's definitions are kept up to date when
we change something in the AST.
2008-06-10 13:57:01 +00:00
Adam Sampson
f2352019ab Implement INITIAL and RESULT abbreviations.
This adds the passes to transform INITIAL into the correct form.

Fixes #42.
2008-06-03 14:57:24 +00:00
Adam Sampson
6ee21f76c9 Initial work on supporting INITIAL and RESULT abbreviations.
This fixes the AST, parser and typechecker, and adds a pass to
transform Result back into Abbrev, but doesn't transform Initial yet.
(It actually works for trivial stuff anyway, but it won't do the right
thing for complex types or PROC parameters.)

It appears (to me) to make sense to support INITIAL/RESULT reshaping
and retyping too, so this does.

Refs #42.
2008-06-02 20:41:37 +00:00