Annotated Class

Alexander Bernauer bernauer at
Wed Jun 13 16:41:23 BST 2012

Hi Benedikt,

thanks for your reply.

On Wed, Jun 13, 2012 at 04:36:26PM +0200, Benedikt Huber wrote:
> Do you already have a patch for that?

Yes, I do. It's attached.


-------------- next part --------------
1 patch for repository

Tue Jun 12 17:20:19 CEST 2012  Alexander Bernauer <bernauer at>
  * Export Annotated type class from AST module

New patches:

[Export Annotated type class from AST module
Alexander Bernauer <bernauer at>**20120612152019
 Ignore-this: 6c213478eb143738cebd0b628486940
] hunk ./src/Language/C/Syntax/AST.hs 55
   CBuiltin, CBuiltinThing(..),
   -- * Constants
   CConst, CStrLit, cstringOfLit, liftStrLit,
-  CConstant(..), CStringLiteral(..)
+  CConstant(..), CStringLiteral(..),
+  -- * Annoated type class
+  Annotated(..)
 ) where
 import Data.List
 import Language.C.Syntax.Constants


[Patch for alex-3.0
benedikt.huber at**20110824112021
 Ignore-this: b0c7e6a7edc7a2184638646f23af965d
[Bump version number after release
benedikt.huber at**20110817153002
 Ignore-this: 754416efc6b50fe597ab713c3bc25771
[TAG 0.4.1
benedikt.huber at**20110816161910
 Ignore-this: 3df26518e1cc264187d00aa8bc9aad2a
[Add 'Tested With' paragraph to the README file
benedikt.huber at**20110816161837
 Ignore-this: a1978612dae25760bb394c4557cd1324
[Add source-repository information to cabal file (supported since HP 2009)
benedikt.huber at**20110816161206
 Ignore-this: d9b232038a2ff9722f1ac2872ddca768
[test/suite/bugs: rewrite to make things compile with gcc-4.5
benedikt.huber at**20110816154828
 Ignore-this: 99d717f6cd8bf24a5afbaf36462ac53
[scripts/regression_test: check for TMPDIR envvar, configure web browser
benedikt.huber at**20110816145009
 Ignore-this: ab50c27ab02e51a7a7a9bfe2a1c78c3e
[test/suite: replace 'sh' with 'bash' (not the same on some Linuxes)
benedikt.huber at**20110816141846
 Ignore-this: a0873bd251fb92f7637c489b5103b885
[test: Remove haskell98 dep from RenderTests.hs, fix some 7.2 warnings for CTest and CRoundTrip
benedikt.huber at**20110816134850
 Ignore-this: e400aa1ea21479c958be509814831e11
[ghc-7.2: Add FlexibleInstances language pragma (thanks to Alexander Bernauer)
benedikt.huber at**20110816133625
 Ignore-this: c5a79263462a93e463a456663bb2adb6
[ghc-7: Add -rtsopts for the test Makefile
benedikt.huber at**20110813120354
 Ignore-this: 7f4f0f408d6a203c800fe3e8c6581fb0
[Export NameSpaceMAp
benedikt.huber at**20110813114553
 Ignore-this: 4ec9f7464cf57be56d8f7c90d8e4b3e5
bernauer at**20110505145145
 Ignore-this: e35f8165fbb174dec61f5b7c3d9673b8
 Using the Haskell parser to pretty print the AST dump of a C sample file
bernauer at**20110505143723
 Ignore-this: 3f8b6d88631165055bc3ae1dd12229b
 using valid Haskell syntax for the string representation of a Ident value
[Derive Show for operators, and only use operator symbols (like '<<') when pretty printing
benedikt.huber at**20110505114132
 Ignore-this: 23c4ec6954c4f930df404711901af83c
 Suggested by Alexander Bernauer. Leads to more consistent Show instances for AST types, which
 have been added recently.
[Remove trailing whitespace from several files
benedikt.huber at**20110505114024
 Ignore-this: 3f72e2fbf094e567037bc04d61ec187c
[Improve the output of scripts/regression_test
benedikt.huber at**20110505113750
 Ignore-this: 1568b78e69ea48545165bd04840a5d62
[Automated Derivations: Use derive-2.5 if available (no need to patch derive-2.4)
benedikt.huber at**20110502141513
 Ignore-this: 11f6e12a8da00b0ac1c26c0cf9947f2
[Fix common misspellings (automatically using
benedikt.huber at**20110417222301
 Ignore-this: e1a05d13a90062afd061adadc54ddacb
[Annotated AST nodes: Functor and Annotated instances, automatic deriving scripts for Derive-2
benedikt.huber at**20110417143710
 Ignore-this: ba9668f8a031fec7a2c94b421a58d79f
 This patch adds a new type class (Annotated), following the Annotated class in haskell-src-exts.
 All AST nodes already have type variables, but sometimes we forgot to use the right type; this is fixed
 now. All AST nodes are now instances of both Annotated (read and change annotation at a node) and fmap
 (change the type of annotations for the syntax tree as a whole). Furthermore, the automated derivation
 scripts have been ported to derive-2, and now use Haskell.Src.Exts instead of Template Haskell.
[DumpAST: Show NodeInfo per default, update ChangeLog and Makefiles
benedikt.huber at**20110417140811
 Ignore-this: 41a02abb0fa71354e927632f16926f3d
Alexander Bernauer <bernauer at>**20110120170640
 Ignore-this: db1718beb0c6e1f55affba080e55dea
[test-harness: Test for Bug N-#6: parsing empty file
benedikt.huber at**20110201131136
 Ignore-this: e5940b6510e4707c826c0486bf52a214
[TAG darcs_apply_bug
benedikt.huber at**20100224071943
 Ignore-this: 2cfa4e1902a3f8a0f0eafc82daa3b3e
[Improve pretty printing of if-then-else statements
benedikt.huber at**20101216110909
 Ignore-this: 220a2dacbf8a1d15b0cf90ced7fbd5ea
[Remove useless UNPACK pragmas (GHC7 warnings)
benedikt.huber at**20101216104025
 Ignore-this: c741569d400be3342af8a6d35c92d0f7
[Fix for GHC 7: Do not import Data.Generics.empty
David Leuschner <david at>**20101215224803
 Ignore-this: 78e3375bdf3804ee4a2278affe9d045d
[Disable custom Monad Either instance for GHC 7
benedikt.huber at**20101215224355
 Ignore-this: c9c3834df5bfee7abb3ac28bce41c2a5
[test-framework: Normalize if-statements to avoid spurious (parse-prettyprint-parse) mismatches for nested if-then-elses
benedikt.huber at**20100721133531
 Ignore-this: 55e5db82a3ca04ccbc7df9a51c9be300
[Add another test for pretty printing if-then-else
benedikt.huber at**20100720212917
 Ignore-this: c0cab673ec9d716deb4154ae5599ed74
[examples: Use matching version of language-c
benedikt.huber at**20100719135907
 Ignore-this: df14d97e62a075c9c10b0544252b6b99
[test/harness: Call Makefile in parent directory
benedikt.huber at**20100719135708
 Ignore-this: 557f27fc83ae5fa9fe33824475e999b7
[Fix signedness bug in constant folding.
Aaron Tomb <aarontomb at>**20101210225335
 Ignore-this: 9ff9f2e4cc27fde2997902fd7d540c35
[Fix bug comparing void pointers to others.
Aaron Tomb <aarontomb at>**20100830000549
 Void pointers are now compatible, in the sense of composite types, with
 all other pointers.
[Temporarily disable a type error message.
Aaron Tomb <aarontomb at>**20100827203839
 It's currently not quite correct. It will be re-enabled once it works
[Add another builtin function (__builtin_strcspn)
Aaron Tomb <aarontomb at>**20100821224347] 
[Array types can be composited with integral types.
Aaron Tomb <aarontomb at>**20100821210957] 
[Error message when mergeOldStyle fails.
Aaron Tomb <aarontomb at>**20100821210814
 The mergeOldStyle function seems to be aimed to remove all old-style
 parameters from the argument list of a function. However, its result
 sometimes includes old-style parameters, causing the previous
 irrefutable pattern to fail. Now, instead of a pattern match failure,
 you get an error message in this case.
[Remove some type error messages.
Aaron Tomb <aarontomb at>**20100821210658
 The type checker was being overly restrictive in its type checks in some
 places, so a few type error messages are disabled until they work
 correctly again.
[Add a couple of builtin functions.
Aaron Tomb <aarontomb at>**20100820221021] 
[Add optional \r before \n (DOS newline) when lexing line pragmas 
benedikt.huber at**20100713230011
 Ignore-this: 4f8dc3973926b89e37f7e506a3d6710
[Add test.expect for bug31_pp_if_else
benedikt.huber at**20100713220843
 Ignore-this: e5cd2f3d1e0d613a47939438f1059cc0
[Add test for bug 5: Lexer chokes on DOS newlines
benedikt.huber at**20100713220142
 Ignore-this: bcac16c711b44c9f6b3b6444450a2253
[Update tExpr to cache node types.
Aaron Tomb <aarontomb at>**20100627164528] 
[Constant-fold casts.
Aaron Tomb <aarontomb at>**20100523223654] 
[The size of a function type is the size of a pointer.
Aaron Tomb <aarontomb at>**20100523223626] 
[Add a few more builtin declarations.
Aaron Tomb <aarontomb at>**20100523223558] 
[Remove broken canonicalName and canonicalIdent functions.
Aaron Tomb <aarontomb at>**20100306195724
 I don't think anyone else was using them, and they don't seem to be
[Fix examples to include additional typequal/attribute fields of SemRep.Type 
benedikt.huber at**20100223220612
 Ignore-this: 606d591e7512226a7fc36173147b261c
[Add type qualifiers and attributes to SemRep.Type
Benedikt Huber **20100223180554
 Ignore-this: 4ac2ed84b60b9edd5523a1446e1e5926
 >> For instance, language-c will accept the following code already:
 >> typedef int foo;
 >> const foo y;
 >> though it's not immediately obvious to me where the const qualifier gets recorded.
 > Oh, that's a [bug] in the analysis:
 > a) type qualifiers are dropped for typedefs (tDirectType) [FIXED]
 > b) type qualifiers are not allowed for typedefs (mergeTypeAttributes) [FIXED]
 > c) attributes are dropped for direct types altogether [FIXED]
 Other than that, the changes were mostly straightforward, still I hope no new bugs have been introduced.
[Fix infinite loop in enumeration constant folding.
Aaron Tomb <aarontomb at>**20100210045301] 
[Add test for bug 31
benedikt.huber at**20100204095654
 Ignore-this: ac96c7279e53d5775adeae2c787cad27
[Fix recently introduced bug with dangling else in pretty-printer
benedikt.huber at**20100204092743
 Ignore-this: fc32765b13ec57bb8906b954c60ac58
[Export 'exportDeclr' in Analysis/Export.hs
benedikt.huber at**20100128104344
 Ignore-this: 65a61348e5e21086cc3aa63ee60d86ab
[Fix type checking bug for function pointer parameters.
Aaron Tomb <aarontomb at>**20100127172548
 The previous patch to add support for transparent unions broke type
 checking of paramters to functions passed via function pointers. If a
 function was defined to take a parameter that was a typedef name, and
 you passed in a function in which the matching parameter was the raw
 type referred to by that typedef, the two would not match because the
 type checker was failing to dereference typedef names in this one case.
[Support a bunch of additional GCC builtins.
Aaron Tomb <aarontomb at>**20100118051615] 
[Support transparent union parameters.
Aaron Tomb <aarontomb at>**20100118051536] 
[Simplify TypeCheck example program.
Aaron Tomb <aarontomb at>**20100118051450] 
[Support type checking of transparent unions.
Aaron Tomb <aarontomb at>**20100111181324] 
[Improve type error reporting for function calls.
Aaron Tomb <aarontomb at>**20100111171616] 
[Improve constant folding for sizeof/alignof.
Aaron Tomb <aarontomb at>**20100111042438] 
[Define sizeofType for UnknownArraySize
Aaron Tomb <aarontomb at>**20091222182612
 An array of unknown size is just a pointer.
[Parametric AST types.
Aaron Tomb <aarontomb at>**20091222182008
 Modify the types in Language.C.Syntax.AST to be parameterized by an
 annotation type. The parser returns ASTs annotated with NodeInfo, but
 other analysis code can replace the annotations.
 The parametric AST types have longer, less abbreviated names. For
 instance, statements are now
   data CStatement a = ...
 with a type synonym
   type CStat = CStatement NodeInfo
[Extend NodeDerive.hs to deal with parametric AST
benedikt.huber at**20091220235521
 Ignore-this: b9783b5f32e559597151eb96b3d5ff2c
[.cabal: recognize separate syb
marco-oweber at**20091130231738
 Ignore-this: 9e0ec55119d163b9d4e439e8d3ee16de
[Arrays can participate in subtraction.
Aaron Tomb <aarontomb at>**20091112193809
 Previously, subtraction was allowed on pointers but not arrays. This
 might be better implemented by coercing arrays to pointers beforehand,
 but this works, and is easier at the moment.
 Eventually, it might be best to refactor the type checker a bit to
 support array->pointer coercion in the right places.
[Export isTypeDef
Aaron Tomb <aarontomb at>**20091112193721] 
[Add __builtin_clz
Aaron Tomb <aarontomb at>**20091112193654] 
[Change pretty-printing of the else branch, s.t. the braces get on a new line
benedikt.huber at**20091101230141
 Ignore-this: a9946733e17d2fefcee4c0bcb46d42b6
[Fix awkward array type checking.
Aaron Tomb <aarontomb at>**20090927200632
 Array type checking was somewhat broken before. During a moment of
 frustration (because some key type checking code was incorrect), I
 decided to convert array types to pointer types immediately after
 getting them out of the symbol table, to simplify type checking.
 Unfortunately, this meant that the types returned by tExpr were never
 array types, even when they should be.
 The other bits of the type checker are in much better shape now, so this
 egregious hack isn't necessary.
[Use pattern matching instead of partial function
Aaron Tomb <aarontomb at>**20090816213828
 Some type checking code used the partial identOfName function in a case
 expression that was already pattern matching on the structure of
 VarName. It's shorter and safer to extract the field directly in this
[Remove unused, buggy fieldOffset function.
Aaron Tomb <aarontomb at>**20090816213737] 
[Replace CStorageSpec Show instance with Pretty instance
Aaron Tomb <aarontomb at>**20090816185348
 CStorageSpec had a Show instance specified in L.C.Syntax.AST, but no
 other data type did. This Show instance was only used in one place, and
 it seemed somewhat inconsistent with the rest of the code. So I removed
 the Show instance from L.C.Syntax.AST, added a Pretty instance in
 L.C.Pretty, and changed the one place that used the Show instance to use
 the Pretty instance instead.
 This could potentially cause incompatibilities with client code, but
 it's unlikely: how often does code need to render storage specifications
 as text but nothing else? Any broken code can be fixed with minimal
[Add constant expression evaluation.
Aaron Tomb <aarontomb at>**20090802235355
 This patch adds basic support for constant expression evaluation. Not
 all cases are handled yet: alignof is not implemented, and the values
 from the initializers for const globals are not yet used.
 This patch also enables proper type checking of the GCC extension
 __builtin_choose_expr, which depends on constant expression evaluation.
[Tighten a bunch of class contexts.
Aaron Tomb <aarontomb at>**20090725044519
 The separation of MonadTrav into several smaller monads makes it
 possible to give more precise types to a number of functions. Many
 functions that previously included the MonadTrav class constrain now
 have one or both of MonadCError and MonadSymtab. They never need to
 generate fresh names or call 'handleDecl'.
[Split MonadTrav into several monads
Aaron Tomb <aarontomb at>**20090724011254
 The MonadTrav class serves several purposes, and some useful functions
 only need some of its available methods. This patch splits it into
 several monads:
 * MonadName, for fresh name generation.
 * MonadSymtab, for symbol table operations.
 * MonadCError, for C-specific error handling.
 * MonadTrav, combining all of the above, plus a callback function.
[Refactor type checking a bit.
Aaron Tomb <aarontomb at>**20090723012504
 Now many of the utility functions in the type checker are pure
 functions, returning Left on error. Clients in the MonadTrav monad can
 use typeErrorOnLeft to turn these into "real" errors.
[Export getUserState and tDesignator
Aaron Tomb <aarontomb at>**20090716234346
 The former is necessary for user state to be at all useful. The latter
 is usable outside of the core type checker, and I found it useful in at
 least one project, so it seems worth exporting.
[Fix bug #29 for real now! And remove typeof from SemRep.
Aaron Tomb <aarontomb at>**20090714035021
 This patch fixes bug #29 for real, without the various breakage the
 previous patch caused. In addition, it allows the third example listed
 in my last patch to typecheck properly.
 This change makes it no longer necessary to have a representation for
 'typeof' in SemRep, so this patch removes that, as well.
[ Fix and DeclEvent CNode instance (reported by Denis Bueno)
benedikt.huber at**20090712213037
 Ignore-this: c601523dba6649a97bb927c452f80e13
[Further progress on bug #29
Aaron Tomb <aarontomb at>**20090620201202
 Ignore-this: d2b78ed617dbd4c3d70df5a92e1e9e4e
 It's now possible to correctly type check this:
     typedef int ax25_dev;
     int f() {
         ax25_dev *ax25_dev, *ax25_dev_old;
 and this:
     typedef int ax25_dev;
     int f() {
         typeof(ax25_dev) *ax25_dev, *ax25_dev_old;
 but not this:
     typedef int ax25_dev;
     int f() {
         typeof(ax25_dev) *ax25_dev, *ax25_dev_old;
         typeof(ax25_dev_old) foo;
 The second line resolves to ax25_dev, which now is an object, not a
 type. Is this valid ANSI C? GCC accepts it.
[Add tests for bug #29.
Aaron Tomb <aarontomb at>**20090228184609] 
[Record use/def link between names.
Aaron Tomb <aarontomb at>**20090222200922
 The DefTable type included a refTable field to record links between use
 and definition Names, but it was unused. Now, whenever analysis code
 calls lookupTypeDef or lookupObject, the link between use and definition
 is store in the refTable. Type checking should fully populate this
 table, because it needs to lookup all uses to ensure that their use is
[Only analyse TypeSpecs once. Fixes #29.
Aaron Tomb <aarontomb at>**20090222183955
 Previously, the type specifiers of declarations with multiple
 declarators were analyzed multiple times. However, when declaring a
 variable with the same name as a type, this causes problems.
   foo *foo, *bar;
 The analysis of "foo *foo" results in a symbol table where the innermost
 definition of "foo" refers to an object, not a typedef name.
 Therefore, when analyzing "foo *bar", the type checker tries to look up
 "foo" and gets an object declaration, which is a type error.
 Code like the above example does actually occur, and is valid C. The
 seemingly equivalent:
   foo *foo;
   foo *bar;
 is not valid C, and is rejected as it should be. The second line is seen
 as an expression statement, multiplying foo and bar, and fails because
 bar is not in scope.
[Change examples to work with the new fileOfNode type sig.
benedikt.huber at**20090223113358
 Ignore-this: 5659ff98882f2808062bc0f1927788f
 This change is somewhat preliminary, as the patch to Data.Position needs to be
 cleaned up.
[Change fileOfNode to return (Maybe FilePath) instead of FilePath
benedikt.huber at**20090223113342
 Ignore-this: 2577930de0523d87de2d54cf674c5de9
[Bump version number
benedikt.huber at**20090223113326
 Ignore-this: eeb0bc1e75401e74993da85ead1e6954
[Better and (hopefully) correct examples for initializer list
benedikt.huber at**20090212123709
 Ignore-this: a97ad65cf2a643ae9d5db8cf6789d4f3
[Improve README in test/harness
benedikt.huber at**20090126170411
 Ignore-this: debc7f4d7c7215ecca631e1506aa5024
[Docuementation for 'position' and 'type PosLength'
benedikt.huber at**20090126164856
 Ignore-this: 1b97e03544f85c929ef9b25e8bed039
[Documentation for Position selectors
benedikt.huber at**20090126164833
 Ignore-this: d7f58d4fed2a7f994f4f854498d3c381
[[Lexer] use incOffset
joe.thornber at**20090126152422] 
[[Position] add incOffset
joe.thornber at**20090126152403] 
[[Position, Lexer] resolve conflicts
joe.thornber at**20090126151257] 
[[Position] documentation
joe.thornber at**20090126095411] 
[[Position, Lexer] Don't export any constructors for Position
joe.thornber at**20090126094323
 Instead use the provided operators to query/update a position.  Only
 the lexer was effected by this.  I hope this doesn't impact
 performance too much.
[[Position] Use record syntax
joe.thornber at**20090126143542] 
[[Ident] Replace an UNBOXED pragma with UNPACK
joe.thornber at**20090126095104
 UNBOXED isn't recognised on 6.10.  When did this pragma get renamed ?
 Do we need to go back and check 6.8 ?
[[Position] Use record syntax when defining Position
joe.thornber at**20090126091403
 That way we get pos{Row,File,Offset,Column} defined for free.
[[Position] Use a summation type for the various position types.
joe.thornber at**20090126085013
 Rather than using magic values for the row and column field I
 think it's cleaner to just define some new constructors for
 <builtin position> etc.  The only reason I can see for the way
 it was is performance/memory.  But if that was the case Position
 would have been defined with newtype.
[Add extra files (README etc.), remove trailing whitespace
benedikt.huber at**20090126101012
 Ignore-this: 7166460f5c6e4f278ed6abf31db337c0
[Add bug-reports field to cabal file
benedikt.huber at**20090126100302
 Ignore-this: daa837cee90f4b63fb66f4fe7a452b0a
[Data.Position: add adjustPos, fix documentation
benedikt.huber at**20090126094425
 Ignore-this: 4fa481b37e55b54aa2090be768a6e2ee
[Rollback the changes to Data.Position.
benedikt.huber at**20090125142419
 Ignore-this: 7985e131c3d6b7fd2f7973f9e8188e90
 Joe Thoerner noted that the column field actually is useful sometimes and that it is used in one of his projects.
 Maybe we should change Position to
 > Position origFile origLine preLine preCol
 ? This seems more consistent than the currently used
 > Position preOffset origFile origLine preColumn
 Need to think about this a little bit.
 rolling back:
 Sat Jan 24 21:15:33 CET 2009  benedikt.huber at
   * Simplify representation of Position.
     M ./src/Language/C/Data/Position.hs -24 +26
     M ./src/Language/C/Parser/Lexer.x -6 +4
[Simplify representation of Position.
benedikt.huber at**20090124201533
 Ignore-this: f1bdb854d8cabd882c08e296bc0f50f5
[Fixed bug #30: 0x0 should have hexadecimal representation
benedikt.huber at**20090113164137] 
[Add test for bug #30
benedikt.huber at**20090113144520] 
[Add ParseAndPrint example to /examples (useful for harness tests)
benedikt.huber at**20090113143148] 
[Add typecheck test to test/src/CRoundTrip
benedikt.huber at**20090113143059] 
[Fix test-framework's runCPP to work with preprocessed files as well
benedikt.huber at**20090113142931] 
[Remove ref to non-existant file from Makefile.
Aaron Tomb <aarontomb at>**20081231225601] 
[Pass statement context into tExpr
Aaron Tomb <aarontomb at>**20081230190851
 Since expressions can contain statements, correct checking requires
 knowledge of the statement context (for instance, the return type of
 the enclosing function, if a statement expression contains a return
[Add example type checking wrapper program.
Aaron Tomb <aarontomb at>**20081230182230] 
[Add __PRETTY_FUNCTION__ builtin.
Aaron Tomb <aarontomb at>**20081230182005] 
[Initial support for __builtin_choose_expr
Aaron Tomb <aarontomb at>**20081230181920] 
[Allow '&' applied to compound literals.
Aaron Tomb <aarontomb at>**20081230181841] 
[More robustness to occurrence of NoName
Aaron Tomb <aarontomb at>**20081230181725] 
[Expose language dialect options
Aaron Tomb <aarontomb at>**20081230181624] 
[Proper error instead of pattern match failure.
Aaron Tomb <aarontomb at>**20081220001942
 When attempting to access a field of a non-composite type, give a real
 type error, rather than a pattern match failure. This was in here
 before, I think, but must have been messed up during refactoring.
[Separate module for much of the type checker.
Aaron Tomb <aarontomb at>**20081219195144] 
[Add more type construction utility functions.
Aaron Tomb <aarontomb at>**20081219193412] 
[Better position info for string constant type.
Aaron Tomb <aarontomb at>**20081219191521] 
[Move type conversions into separate module.
Aaron Tomb <aarontomb at>**20081219191250] 
[Add stopping criteria to mapSubStmts
Aaron Tomb <aarontomb at>**20081217233833] 
[Add (unenforced) options for C language subset.
Aaron Tomb <aarontomb at>**20081216174157] 
[Move builtins to a separate module.
Aaron Tomb <aarontomb at>**20081215234146] 
[Improve type normalization.
Aaron Tomb <aarontomb at>**20081212224522] 
[Improve error messages in type checker.
Aaron Tomb <aarontomb at>**20081212224334] 
[Fix treatment of & when applied to array name.
Aaron Tomb <aarontomb at>**20081212224223] 
[Pretty-print chained fields in initializers.
Aaron Tomb <aarontomb at>**20081212001828] 
[Inline functions can appear before register globals.
Aaron Tomb <aarontomb at>**20081211234309] 
[Add support for global register variables.
Aaron Tomb <aarontomb at>**20081211194010] 
[Add expected output for type checking tests.
Aaron Tomb <aarontomb at>**20081211193835] 
[Remove redundant cast compatibility check.
Aaron Tomb <aarontomb at>**20081211004159] 
[Fill in missing case in type export code.
Aaron Tomb <aarontomb at>**20081211004138] 
[One more builtin!
Aaron Tomb <aarontomb at>**20081211004108] 
[More builtins
Aaron Tomb <aarontomb at>**20081211003714
 Now runTrav populates the symbol table with all of the builtins used by
 Linux (as of
[Code to merge name spaces and definition tables
Aaron Tomb <aarontomb at>**20081211003525
 It can be useful to merge symbol tables on occasion. It doesn't make any
 sense to do this if they disagree about the values associated with their
 respective keys, but there are many cases when you can guarantee that
 they will agree.
[Add __builtin_expect to builtins
Aaron Tomb <aarontomb at>**20081210223952] 
[Add some test cases for type checking
Aaron Tomb <aarontomb at>**20081209003856] 
[Typedefs can be block scoped
Aaron Tomb <aarontomb at>**20081209003218
 Under certain circumstances, the standard says that typedefs have block
 scope. GCC seems even more liberal, treating typedefs just like any
 other identifier, with scope extending to the end of the innermost
 block. To handle code such as Linux, we now do the same.
[Fix corner cases in compound initializer checking
Aaron Tomb <aarontomb at>**20081209002952
 Compound array and structure initializer lists with complex combinations of
 designated and undesignated elements now type check. The bulk of Linux now goes through with only one error.
[New code for canonical types
Aaron Tomb <aarontomb at>**20081209002819] 
[Another attempt at structure type checking.
Aaron Tomb <aarontomb at>**20081206022456] 
[Fix fiddly bits of structure and union checking
Aaron Tomb <aarontomb at>**20081206000054
 Nested structures and unions weren't being handled correctly, especially
 in initializers. Now we can check members of anonymous union members as
 if they were direct members, and we can initialize nested structures.
 For example, we now accept:
 struct baz { int a; union { int b; int c; }; } v = { .a = 0, .b = 1 };
 struct foo { int x; struct bar { int y; } inner; } z = { .x = 0, .inner.y = 1 };
[Allow void functions to return void expressions
Aaron Tomb <aarontomb at>**20081205235436
 There really is code (in Linux) that looks like this:
 void g();
 void f() { return g(); }
 The standard doesn't allow it ( but GCC does, so it seems
 useful to allow it ourselves, too.
 Eventually, it would make sense to have some configuration settings that
 describe exactly which variant of the language to accept. In strict C99
 mode, we'd reject this.
[Include anonymous structure members in analysis
Aaron Tomb <aarontomb at>**20081205235158
 When typechecking structure declarations, we previously skipped
 anonymous members. Now anonymouse structure and union members are
 included in the symbol table (and anonymous members of non-composite
 type are rejected).
[Update linkage rules for redefinition
Aaron Tomb <aarontomb at>**20081205230750
 From my reading of the standard, it seems as though, if the original
 declaration (or definition) of a function has internal linkage, then a
 later declaration (or definition) can have either internal or external
 linkage. GCC seems to agree with this.
[Allow calls to unknown functions in type checker.
Aaron Tomb <aarontomb at>**20081204235538] 
[Remove redundant code from type checker
Aaron Tomb <aarontomb at>**20081204230358] 
[Export a few more things from AstAnalysis
Aaron Tomb <aarontomb at>**20081204225815] 
[Improve error message formatting
Aaron Tomb <aarontomb at>**20081204225758] 
[Move generally-useful functions to separate module
Aaron Tomb <aarontomb at>**20081204225416
 There is now a Language.C.Syntax.Utils module that contains useful
 functions for dealing with ASTs. Right now, these include a
 manually-written traversal to extract sub-statements and one to apply a
 function to all sub-statements. These might be better written with some
 sort of generic programming framework in the future.
[Export tStmt
Aaron Tomb <aarontomb at>**20081203205009] 
[Remove typeof as early as possible
Aaron Tomb <aarontomb at>**20081202182528
 Remove typeof when translating from C types to Types. This requires
 DeclAnalysis to have the ability to typecheck expressions. I've decided
 that making AstAnalysis and DeclAnalysis mutually recursive is the
 simplest and cleanest way to do this for now.
[Typecheck initializers later (fixes #25)
Aaron Tomb <aarontomb at>**20081202181725
 Typecheck initializers after entering the variable they initialize into
 the symbol table. For the moment, this works, but it will break if
 Initializer becomes different from CInit.
[Add local labels in block scope.
Aaron Tomb <aarontomb at>**20081202175734
 This patch undoes my previous "fix" of getSubStmts and does things
 properly inside getLabels, instead. Now, function-scope labels are all
 added before we start type checking the function, and local labels are
 added when entering the block they live in.
 Ultimately, the utility functions getSubStmts, compoundSubStmts, and
 getLabels probably belong somewhere in the Language.C.Syntax.*
[Change block scopes to create new label scope, too.
Aaron Tomb <aarontomb at>**20081202175442
 This makes local labels work out properly. We should scan a function body
 for non-local labels and add them all inside the initial function scope,
 anyway, since labels can jump backward, so this shouldn't cause any
[Remove typeof from field types.
Aaron Tomb <aarontomb at>**20081202002921] 
[Handle initializers on variables with typeof types.
Aaron Tomb <aarontomb at>**20081202000143] 
[Export TypeOfExpr, because we can.
Aaron Tomb <aarontomb at>**20081201233716
 This is useful for debugging, primarily, so we can print typeof types.
 Ultimately, it may not be necessary if we get rid of them entirely.
[Initial import of type checker.
Aaron Tomb <aarontomb at>**20081201230325
 This patch adds a type checker for expressions and statements. It is
 almost certainly incomplete at this point, but passes some tests.
[Add a module of type utility functions
Aaron Tomb <aarontomb at>**20081201190109
 These are all simple, pure functions for operating on types that are
 certainly useful in type checking, but may be useful in other contexts,
 as well.
[Add a number of C operator utility functions
Aaron Tomb <aarontomb at>**20081201185545] 
[examples/ScanFile: improve guessing of 'interesting declarations'
benedikt.huber at**20081130115603] 
[Add sanity check to AST analysis - we should be in file scope afterwards
benedikt.huber at**20081130115510] 
[Declare params of prototype in prototype-scope; remove unneccessary enterBlockScope after enterFunctionScope
benedikt.huber at**20081130113349
 Parameters of prototypes must not be declared in global scope of course.
 enterFunctionScope also introduces a local scope, so we don't have to call enterBlockScope afterwards
[Cleanup test/harness, add test for local variable declarations
benedikt.huber at**20081129171215] 
[Use Analysis.Debug when tracing in examples/ScanFile
benedikt.huber at**20081129170804] 
[Fix scopes for parameters and local variable declarations
benedikt.huber at**20081129170538
 1) The parameters of a function have to be declared in the scope of the outermost block of the function
 2) We have to search for local declarations in all statements (for,while, etc.)
 3) handleParamDecl is called in AstAnalysis not tParam
[Improve check for redeclarations
benedikt.huber at**20081129170341
 We now check if the old identifier has been declared with the same linkage (and if it has linkage).
 Appropriate error constructors have been added to SemError.
[Add (Static NoLinkage _) for local declarations with static specifier
benedikt.huber at**20081129170312] 
[Add tracing for ParamEvent/LocalEvent to examples/ScanFile
benedikt.huber at**20081127111248] 
[First leave function scope, then add function definition
benedikt.huber at**20081127111207] 
[Fix/cleanup storage computation for global and local variables
benedikt.huber at**20081127110518] 
[Export travErrors
Aaron Tomb <aarontomb at>**20081126003005] 
[Builtin return and frame addresses
Aaron Tomb <aarontomb at>**20081125230201] 
[Add some more builtins
Aaron Tomb <aarontomb at>**20081125223538] 
[Local variables can have external linkage
Aaron Tomb <aarontomb at>**20081125223500] 
[Add some GCC builtins
Aaron Tomb <aarontomb at>**20081124210541
 Start AST traversals with a symbol table pre-populated with common
 builtin functions including some math routines and varargs handlers.
[Handle merge conflict related to bug #21
Aaron Tomb <aarontomb at>**20081122211125] 
[Add labels to symbol table
Aaron Tomb <aarontomb at>**20081121232244] 
[Better (working) code for function-scope symbols
Aaron Tomb <aarontomb at>**20081121005020
 The patch from 11/18 purported to record local variables in the symbol
 table, but it was broken in various ways. Now it should work.
[Resolve merge conflict
Aaron Tomb <aarontomb at>**20081122210354] 
[Add local variables to symbol table
Aaron Tomb <aarontomb at>**20081118212831
 This patch adds local variables to the symbol table, and introduces two
 new event types, one for parameter declarations and one for local
 variable declarations.
[More informative error message about unbound typedefs
Aaron Tomb <aarontomb at>**20081120224556] 
[Add DefTable pretty-printing to L.C.A.Debug
Aaron Tomb <aarontomb at>**20081119223851] 
[Fix cabal file for compilation with GHC 6.10.1
Aaron Tomb <aarontomb at>**20081117214250
 This should be backward-compatible. It just adds an upper bound to the
 version of base required, and 6.10.1 comes with base3.
[Pretty-print abstract parameter declarations.
Aaron Tomb <aarontomb at>**20081117214157] 
[Handle typedefs in mergeTypeAttributes
Aaron Tomb <aarontomb at>**20081117214036] 
[test/harness: regression test for bug #21, bug #22
benedikt.huber at**20081122122124] 
benedikt.huber at**20081122121858] 
[Fix bug #22: Set file permission after copying input
kcharter at**20081122121617] 
[Updated SourceView
benedikt.huber at**20081120103351] 
[Fix bug in lexer: recursive lexToken
benedikt.huber at**20081120103318] 
[Fix bug #21: typedef can have more than one declarator
benedikt.huber at**20081120100715] 
[Improvments to examples/sourceview
benedikt.huber at**20081005210053
 The sourceview example can now be used for debugging large ASTs as well.
 It isn't finished yet, though.
[Fixing bugs in recording the location of AST nodes
benedikt.huber at**20081005205846
 For computing the last token of an AST node, we safed
 the previous token and the one before that. Recursively
 invoking lexToken (line pragmas) has to take this into account.
 Additionally, fixed some wrong withNodeInfo calls in the Parser.
[examples/sourceview: A (preprocessed) C soure code / AST browser
benedikt.huber at**20081001154619] 
[[EXPERIMENTAL] Source code annotations: add absolute offset to Position and last token position and length to NodeInfo
benedikt.huber at**20081001153016
 We safe the absolute offset (in the preprocessed file) in Data.Position and the position and length of the last token of each AST node in Data.NodeInfo.This allows source code annotations of preprocessed code, and should allow interaction with custom preprocessors.
[test-suite/bugs: empty.c (an empty file, caused troubles with positional information)
benedikt.huber at**20081001124618] 
[examples: Use initPos and undefNode
benedikt.huber at**20081001102105] 
[Use initPos instead of the explicit Position data constructor (test/src)
benedikt.huber at**20081001101255] 
[add 'parseCFilePre' to Language.C
benedikt.huber at**20080930160311] 
[bin/cc-wrapper: Surround shell argument with double quotes
benedikt.huber at**20080919141649] 
[Bump version number (so it is different from the one released on hackage)
benedikt.huber at**20080917091947] 
[adjustPos (change to line of another file) should set column offset to one (fixes bug #18)
benedikt.huber at**20080917091753] 
[TAG 0.3.1
benedikt.huber at**20080821123218] 
Patch bundle hash:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <>

More information about the Language-c mailing list