summaryrefslogtreecommitdiff
path: root/ghc/compiler/reader
Commit message (Collapse)AuthorAgeFilesLines
* [project @ 1999-06-01 16:40:41 by simonmar]simonmar1999-06-015-2246/+0
| | | | | | | | | | | | | | | | | | | | | | | | | This commit replaces the old yacc parser with a Happy-generated one. Notes: - The generated .hs file is *big*. Best to use a recent version of Happy, and even better to add the -c flag to use unsafeCoerce# with ghc (versions 4.02+ please). - The lexer has grown all sorts of unsightly growths and should be put down as soon as possible. - Parse errors may result in strange diagnostics. I'm looking into this. - HsSyn now contains a few extra constructors due to the way patterns are parsed as expressions in the parser. - The layout rule is implemented according to the Haskell report. I found a couple of places in the libraries where we previously weren't adhering to this - in particular the rule about "nested contexts must be more indented than outer contexts". The rule is necessary to disambiguate in the presence of empty declaration lists.
* [project @ 1999-05-18 15:03:54 by simonpj]simonpj1999-05-185-192/+244
| | | | RULES-NOTES
* [project @ 1999-05-11 16:37:29 by keithw]keithw1999-05-112-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (this is number 4 of 9 commits to be applied together) The major purpose of this commit is to introduce usage information and usage analysis into the compiler, per the paper _Once Upon a Polymorphic Type_ (Keith Wansbrough and Simon Peyton Jones, POPL'99, and Glasgow TR-1998-19). Usage information has been added to types, in the form of a new kind of NoteTy: (UsgNote UsageAnn(UsOnce|UsMany|UsVar UVar)). Usages print as __o (once), __m (many, usually omitted), or (not in interface files) __uvxxxx. Usage annotations should only appear at certain places in a type (see the paper). The `default' annotation is __m, and so an omitted annotation implies __m. Utility functions for handling usage annotations are provided in Type. If the compiler is built with -DUSMANY (a flag intended for use in debugging by KSW only), __m are *required* and may not be omitted. The major constraint is that type arguments (eg to mkAppTy) must be unannotated on top. To maintain this invariant, many functions required the insertion of Type.unUsgTy (removing annot from top of a type) or UsageSPUtils.unannotTy (removing all annotations from a type). A function returning usage-annotated types for primops has been added to PrimOp. A new kind of Note, (TermUsg UsageAnn), has been added to annotate Terms. This note is *not* printed in interface files, and for the present does not escape the internals of the usage inference engine.
* [project @ 1999-04-13 08:55:33 by kglynn]kglynn1999-04-131-2/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | (keving) Big Bang introduction of CPR Analysis Pass. Note that now -fstrictness only does the strictness analysis phase, it is necessary to follow this with -fworker-wrapper to actually do the required Core transformations. The -O option in the ghc driver script has been modified appropriately. For now, CPR analysis is turned off. To try it, insert a -fcpr_analyse between the -fstrictness and the -fworker-wrapper options. Misc. comments: - The worker flag has been removed from an ID's StrictnessInfo field. Now the worker info is an extra field in the Id's prag info. - We do a nested CPR analysis, but worker-wrapper only looks at the info for the outermost constructor, else laziness can be lost. - Id's CPR Info in traces and interfaces file follows __M - Worker-wrappery transformation now accounts for both strictness and CPR analysis results.
* [project @ 1999-03-25 13:13:51 by simonm]simonm1999-03-251-2/+0
| | | | | | | | | | | Profiling fixes. - top-level CAF CCSs now *append* themselves to the current CCS when called. - remove DICT stuff. - fixes to the auto-scc annotating in the desugarer.
* [project @ 1999-03-15 15:11:03 by simonpj]simonpj1999-03-152-16/+27
| | | | | | | | | | | | | | | | | Make clear in HsType whether a for-all is explicit in the source program or not. Implicit for-alls now look like HsForAllTy Nothing ctxt ty while explicit ones look like HsForAllTy (Just tvs) ctxt ty Before this, the scope analysis stuff in RnSource was actually wrong (not that anyone had noticed), but Alex Ferguson did notice a bogus (sort-of-duplicate) error message on types like f :: Eq a => Int -> Int which led me to spot the deeper problem. Anyway, it's all cool now.
* [project @ 1999-03-02 18:31:51 by sof]sof1999-03-022-5/+5
| | | | import list adjustments
* [project @ 1999-01-27 14:51:14 by simonpj]simonpj1999-01-274-211/+98
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Finally! This commits the ongoing saga of Simon's hygiene sweep FUNCTIONALITY ~~~~~~~~~~~~~ a) The 'unused variable' warnings from the renamer work. b) Better error messages here and there, esp type checker c) Fixities for Haskell 98 (maybe I'd done that before) d) Lazy reporting of name clashes for Haskell 98 (ditto) HYGIENE ~~~~~~~ a) type OccName has its own module. OccNames are represented by a single FastString, not three as in the last round. This string is held in Z-encoded form; a decoding function decodes for printing in user error messages. There's a nice tight encoding for (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) b) type Module is a proper ADT, in module OccName c) type RdrName is a proper ADT, in its own module d) type Name has a new, somwhat tidier, representation e) much grunting in the renamer to get Provenances right. This makes error messages look better (no spurious qualifiers)
* [project @ 1999-01-22 13:12:22 by sof]sof1999-01-221-0/+1
| | | | ifaceKeywordsFM: adding missing __ccall_GC entry
* [project @ 1999-01-19 14:40:00 by sof]sof1999-01-191-1/+1
| | | | | foreign decls: use wlkHsSigType, not wlkHsType, since the tysig may have implicitly quantified tyvars.
* [project @ 1999-01-18 19:04:55 by sof]sof1999-01-181-3/+3
| | | | | Print out warnings/errors in the order they occur in the source code. (Well...almost, warnings are sorted and printed out on a per-pass basis.)
* [project @ 1999-01-14 19:53:57 by sof]sof1999-01-141-5/+8
| | | | Fixes to support .hi unfoldings containing "_ccall_ dynamic"s
* [project @ 1999-01-14 17:58:41 by sof]sof1999-01-142-19/+32
| | | | | | | | | | | | | | | | | | | | | | | | Assorted minor Haskell 98 changes: * Maximal munch rule for "--" comments * _ as lower-case letter, "_" is a reserved id. Prefixing unused variable names in patterns with '_' causes the renamer not to report such names as being unused. * allow empty decls * comprehensions are now list comprehensions, not monadic. * use Monad.fail to signal pattern matching errors within do expressions. * remove record punning. * empty contexts are now legal (go wild!) * allow records with no fields * allow newtypes with a labelled field * default default is now (Integer, Double) * turn off defaulting mechanism for args & res to a _ccall_. * allow LHSs of the form (a -.- b) x = ... * Main.main can now have type (IO a) * nuked Void (and its use in the compiler sources.) * deriving machinery for Enum now also generate 'succ' and 'pred' method bindings.
* [project @ 1998-12-18 17:40:31 by simonpj]simonpj1998-12-185-421/+298
| | | | | | | | | | | | | | | | | | | | | Another big commit from Simon. Actually, the last one didn't all go into the main trunk; because of a CVS glitch it ended up in the wrong branch. So this commit includes: * Scoped type variables * Warnings for unused variables should work now (they didn't before) * Simplifier improvements: - Much better treatment of strict arguments - Better treatment of bottoming Ids - No need for w/w split for fns that are merely strict - Fewer iterations needed, I hope * Less gratuitous renaming in interface files and abs C * OccName is a separate module, and is an abstract data type I think the whole Prelude and Exts libraries compile correctly. Something isn't quite right about typechecking existentials though.
* [project @ 1998-12-02 13:17:09 by simonm]simonm1998-12-025-653/+576
| | | | Move 4.01 onto the main trunk.
* [project @ 1998-11-16 11:56:09 by sof]sof1998-11-161-1/+6
| | | | Cleaned up the handling of the default calling conventions for 'foreign' decls
* [project @ 1998-11-13 19:34:33 by sof]sof1998-11-131-3/+4
| | | | Allow 'foreign import' calling conv. to be optional
* [project @ 1998-11-08 17:10:35 by sof]sof1998-11-082-5/+6
| | | | First take at 'foreign label's
* [project @ 1998-09-04 20:14:50 by sof]sof1998-09-041-2/+0
| | | | In an interface file, don't allow data and newtype decls to have deriving clauses (not needed.)
* [project @ 1998-08-14 11:48:39 by sof]sof1998-08-145-8/+60
| | | | Reading in foreign decls
* [project @ 1998-06-10 13:29:21 by sof]sof1998-06-101-46/+14
| | | | | | | - remove unused code - added -fno-hi-version-check - (commented out) support for @-files, i.e., pass hsc its command-line switches via a temporary file.
* [project @ 1998-05-22 15:23:11 by simonm]simonm1998-05-221-0/+5
| | | | | | | | | | | | | Add NOINLINE pragma. - add new type of inline info: IDontWantToBeINLINEd - hopefully get the interactions between IMustNotBeINLINEd (which is used by the simplifier to ensure termination when simplifying recursive binding groups) and IDontWantToBeINLINEd. - no need to pass NOINLINE across modules, we just make sure that any function marked as NOLINE doesn't get an unfolding in the interface.
* [project @ 1998-05-11 16:19:46 by simonm]simonm1998-05-111-6/+14
| | | | | Convert floating point literals from interfaces directly to Rationals, rather than go via Doubles.
* [project @ 1998-05-04 21:02:06 by sof]sof1998-05-041-1/+1
| | | | mk_thing: Added non-overloaded type signature
* [project @ 1998-04-29 09:26:26 by sof]sof1998-04-291-1/+1
| | | | import fix to make 3.02 happy
* [project @ 1998-04-06 18:38:36 by sof]sof1998-04-064-48/+18
| | | | Misc changes by Simon to emit and handle cross-module specialisations
* [project @ 1998-03-19 23:54:49 by simonpj]simonpj1998-03-191-3/+5
| | | | Reorganisation of Id, IdInfo. Remove StdIdInfo, PragmaInfo; add basicTypes/MkId.lhs
* [project @ 1998-03-19 17:44:26 by simonpj]simonpj1998-03-191-2/+2
| | | | Minor simplifier fixes
* [project @ 1998-02-25 19:48:54 by sof]sof1998-02-251-1/+33
| | | | | | | | | | | | | | | | | | | Interface file version checking support. Added a compiler version field to the interface file header. The format is now _interface_ <IfaceName> <ModuleVersion> <CompilerVersion> where the compiler version follow the value of $(ProjectVersionInt). Any mismatch in version numbers causes the renamer to give up. A compiler version number of 0 means turn off version checking (used by PrelGHC.hi to avoid having to update every time we release.) .hi-boot files are treated specially, the absence of a compiler version number in the header is taken to mean that there was a `0'. Need to do this since hsc's .hi-boot files have to also be useable by versions of the compiler that don't grok version info in interface files (e.g., ghc-2.10.)
* [project @ 1998-02-10 17:14:23 by simonm]simonm1998-02-101-0/+2
| | | | fixes for errors in last commit.
* [project @ 1998-02-10 14:15:51 by simonpj]simonpj1998-02-102-1/+14
| | | | Several small fixes to multi-param type classes
* [project @ 1998-02-03 22:20:10 by sof]sof1998-02-031-1/+5
| | | | | | | | | | | | Support for assertions: - if `assert' is not a variable name within scope, it is expanded to (GHCerr.assert__ <srcLoc>), GHCerr.assert__ :: String -> Bool -> a -> a where <srcLoc> encodes module name plus line number of the assertion. - enabled with -fglasgow-exts
* [project @ 1998-02-03 17:13:54 by simonm]simonm1998-02-032-6/+3
| | | | | | | | - Fixes for bootstrapping with 3.01. - Use 'official' extension interfaces rather than internal prelude modules (such as ArrBase) where possible. - Remove some cruft. - Delete some unused imports found by '-fwarn-unused-imports'.
* [project @ 1998-01-12 09:29:22 by simonpj]simonpj1998-01-121-0/+13
| | | | Fix renamer global/local env bug
* [project @ 1998-01-08 18:03:08 by simonm]simonm1998-01-085-268/+234
| | | | | | | | | | | | | | | | | | | The Great Multi-Parameter Type Classes Merge. Notes from Simon (abridged): * Multi-parameter type classes are fully implemented. * Error messages from the type checker should be noticeably improved * Warnings for unused bindings (-fwarn-unused-names) * many other minor bug fixes. Internally there are the following changes * Removal of Haskell 1.2 compatibility. * Dramatic clean-up of the PprStyle stuff. * The type Type has been substantially changed. * The dictionary for each class is represented by a new data type for that purpose, rather than by a tuple.
* [project @ 1997-12-19 10:49:45 by sof]sof1997-12-191-27/+0
| | | | Cleaned out old defnition of lex_id
* [project @ 1997-12-17 13:14:21 by simonm]simonm1997-12-171-5/+3
| | | | | | | * remove explicit lexing of '::' which didn't take into account tokens that begin with '::'. * remove duplicate ':' case from is_sym. * add '::' as a builtin identifier, mapped to ITdcolon.
* [project @ 1997-12-04 11:02:12 by simonm]simonm1997-12-041-8/+8
| | | | | | fix huge bug in extractHsTyVars - the list returned wasn't always a set (i.e. it could have duplicates). This screwed up support for universal quantification in a couple of places.
* [project @ 1997-11-27 10:53:52 by simonm]simonm1997-11-271-1/+1
| | | | fix bogon in last commit.
* [project @ 1997-11-26 10:24:18 by simonm]simonm1997-11-261-0/+3
| | | | fix for booting with 2.01 <= GHC < 2.09
* [project @ 1997-11-24 20:10:33 by sof]sof1997-11-242-13/+17
| | | | fix to have it compile with 2.09 (and later)
* [project @ 1997-10-08 12:08:14 by simonm]simonm1997-10-081-6/+12
| | | | | Fix for special prelude names ((),[],-> etc) when compiling with -fno-implicit-prelude.
* [project @ 1997-10-07 14:51:49 by simonm]simonm1997-10-071-1/+1
| | | | add missing IFaceFlavour field.
* [project @ 1997-10-06 09:52:41 by simonm]simonm1997-10-061-4/+12
| | | | fix for qualified Prelude / () bug
* [project @ 1997-09-24 09:08:21 by simonm]simonm1997-09-243-9/+0
| | | | Remove deforester
* [project @ 1997-09-04 20:17:37 by sof]sof1997-09-041-6/+18
| | | | lex M.-> properly
* [project @ 1997-09-03 10:43:01 by simonm]simonm1997-09-031-0/+8
| | | | | Fix exporting of (->) instances. This is the fix from the web page with minor changes for the new continuation-passing lexer.
* [project @ 1997-08-25 21:53:50 by sof]sof1997-08-251-1/+1
| | | | Updated to reflect RecordCon change
* [project @ 1997-08-12 12:18:01 by simonm]simonm1997-08-121-126/+127
| | | | | Support new version of Happy. The interface file parsers now require the version of Happy in the tree to compile.
* [project @ 1997-08-02 21:28:33 by sof]sof1997-08-021-0/+9
| | | | Added reader handling of let expressions in pattern guards