language-c: Analysis and generation of C code

[ bsd3, language, library ] [ Propose Tags ] [ Report a vulnerability ]

Language C is a Haskell library for the analysis and generation of C code. It features a complete, well tested parser and pretty printer for all of C99 and a large set of C11 and clang/GNU extensions.


[Skip to Readme]

Flags

Manual Flags

NameDescriptionDefault
usebytestrings

Use ByteString as InputStream datatype

Enabled
iecfpextension

Support IEC 60559 floating point extension (defines _Float128)

Enabled

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.3.0, 0.3.1, 0.3.1.1, 0.3.2, 0.3.2.1, 0.4.1, 0.4.2, 0.4.3, 0.4.4, 0.4.5, 0.4.6, 0.4.7, 0.5.0, 0.6, 0.6.1, 0.7.0, 0.7.1, 0.7.2, 0.8, 0.8.1, 0.8.2, 0.8.3, 0.9, 0.9.0.1, 0.9.0.2, 0.9.1, 0.9.2, 0.9.3, 0.9.4, 0.10.0
Change log ChangeLog.md
Dependencies array (<0.6), base (>=4.9 && <5), bytestring (>=0.9.0 && <0.13), containers (>=0.3 && <0.8), deepseq (>=1.4.0.0 && <1.6), directory (<1.4), filepath (<1.6), mtl (<2.4), pretty (<1.2.0), process (<1.7) [details]
Tested with ghc ==9.12.1, ghc ==9.10.1, ghc ==9.8.2, ghc ==9.6.6, ghc ==9.4.8, ghc ==9.2.8, ghc ==9.0.2, ghc ==8.10.7, ghc ==8.8.4, ghc ==8.6.5, ghc ==8.4.4, ghc ==8.2.2, ghc ==8.0.2
License BSD-3-Clause
Copyright LICENSE
Author AUTHORS
Maintainer language.c@monoid.al
Category Language
Home page https://visq.github.io/language-c/
Bug tracker https://github.com/visq/language-c/issues/
Source repo head: git clone https://github.com/visq/language-c.git
Uploaded by Bodigrim at 2024-11-17T23:09:27Z
Distributions Arch:0.9.4, Debian:0.9.0.1, Fedora:0.9.2, FreeBSD:0.4.7, LTSHaskell:0.9.4, NixOS:0.9.3, Stackage:0.10.0, openSUSE:0.9.4
Reverse Dependencies 11 direct, 55 indirect [details]
Downloads 61661 total (388 in the last 30 days)
Rating 2.0 (votes: 1) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user
Build status unknown [no reports yet]

Readme for language-c-0.10.0

[back to package description]

Language.C

Language.C is a parser and pretty-printer framework for C11 and the extensions of gcc.

See http://visq.github.io/language-c/

C Language Compatibility

Currently unsupported C11 constructs:

  • static assertion 6.7.10 (_Static_assert)
  • generic selection 6.5.1.1 (_Generic)
  • _Atomic, _Thread_local
  • Universal character names

Currently unsupported GNU C extensions:

  • __auto_type
  • __builtin_offsetof char a[__builtin_offsetof (struct S, sa->f)
  • _Decimal32
  • Extended assembler __asm__ __volatile__ ("" : : : ); __asm__ goto ("" : : : : label);
  • __attribute__((packed)): types featuring this attribute may have an incorrect size or alignment calculated.

IEC 60559:

Since language-c-0.8, extended floating point types are supported (gcc 7 feature). Package maintainers may decide to disable these types (flag iecFpExtension) to work around the fact that the _Float128 type is redefined by glibc >= 2.26 if gcc < 7 is used for preprocessing:

  /* The type _Float128 exists only since GCC 7.0.  */
  # if !__GNUC_PREREQ (7, 0) || defined __cplusplus
  typedef __float128 _Float128;
  # endif

Examples

A couple of small examples are available in examples.

Testing

See test/README.