GithubHelp home page GithubHelp logo

language-c99-simple's People

Contributors

avieth avatar fdedden avatar felixonmars avatar ivanperez-keera avatar ryanglscott avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

language-c99-simple's Issues

Release 0.2.2

For this version we apply a minor version bump, as only a feature has been added, no semantics have changed.

checklist

  • Bump version number.
  • Check version numbers of dependencies.
  • Update changelog.
  • Tag the version.
  • Test a test build.
  • Upload to hackage.
  • Deprecate 0.2.0.

How to do includes?

How do I get an #include <stdio.h>? Is it possible, or do I need to drop down to language-c99?

Release 0.2.3

For this version we apply a minor version bump, as only a dependency version has changed.

Checklist

  • Bump version number.
  • Check version numbers of dependencies.
  • Update changelog.
  • Tag the version.
  • Test a test build.
  • Upload to hackage.

`language-c99-simple-0.2.0.0` regression involving initializer lists

(Originally reported at Copilot-Language/copilot#335 (comment).)

After upgrading to language-c99-simple-0.2.0.0, I noticed that array initializers were being pretty-printed in a different order than what older versions of the library would print. Here is a minimal example that demonstrates the issue, with some light CPP used to paper over API differences between the two major versions of the library:

#!/usr/bin/env cabal
{- cabal:
build-depends: base, language-c99, language-c99-simple
-}
{-# LANGUAGE CPP #-}
module Main where

import GHC.Exts (IsList(..))
import Language.C99.Pretty
import Language.C99.Simple

arr :: Init
arr =
#if MIN_VERSION_language_c99_simple(0,2,0)
  InitList $
#else
  InitArray $
#endif
  fromList [ boolInit True
           , boolInit False
           , boolInit False
           , boolInit False
           , boolInit False
           ]

#if MIN_VERSION_language_c99_simple(0,2,0)
boolInit :: Bool -> InitItem
boolInit = InitItem Nothing . InitExpr . LitBool
#else
boolInit :: Bool -> Init
boolInit = InitExpr . LitBool
#endif

main :: IO ()
main = print $ pretty $ transinit arr

Running this program with language-c99-simple-0.1.* gives this order, as expected:

$ cabal run Bug.hs --constraint="language-c99-simple<0.2"
<snip>
{(true), (false), (false), (false), (false)}

On the other hand, running this program with language-c99-simple-0.2.* gives an unexpected order:

$ cabal run Bug.hs --constraint="language-c99-simple>=0.2"
<snip>
{(false), (false), (false), (false), (true)}

Notice that the true element is now at the end of the array instead of the beginning. Bisecting reveals that commit 86fe2b3 is responsible for this regression.

Release 0.3.0

For this version we apply a major version bump, as we broke the public interface.

Checklist

  • Bump version number.
  • Check version numbers of dependencies.
  • Update changelog.
  • Tag the version.
  • Test a test build.
  • Upload to hackage.

Add `StorageSpec` to `FunDef`

Unlike FunDecln, which is defined as:

FunDecl (Maybe StorageSpec) Type Ident [Param]

a FunDef does not include a StorageSpec (optional or not):

FunDef Type Ident [Param] [Decln] [Stmt]

This prevents us from adding the keyword static to local functions, which is a requirement for compliance with MISRA C 2012 in Copilot (see Copilot-Language/copilot#472), which we really want to get.

Release 0.2.1

  • Bump version number.
  • Check version numbers of dependencies.
  • Update changelog.
  • Tag the version.
  • Test a test build.
  • Upload to hackage.
  • Deprecate 0.2.0.

For this specific release we will do a minor version bump even though the API has changed. The previous release erroneously changed the API, this release fixes that again.

Failure to compile with GHC 8.6

Things have changed in base 4.12. This library no longer compiles:

Configuring language-c99-simple-0.1.0.0...
Building language-c99-simple-0.1.0.0...
Preprocessing library language-c99-simple-0.1.0.0...
[1 of 5] Compiling Language.C99.Simple.AST ( src/Language/C99/Simple/AST.hs, dist/dist-sandbox-11467d12/build/Language/C99/Simple/AST.o )
[2 of 5] Compiling Language.C99.Simple.Expr ( src/Language/C99/Simple/Expr.hs, dist/dist-sandbox-11467d12/build/Language/C99/Simple/Expr.o )
[3 of 5] Compiling Language.C99.Simple.Util ( src/Language/C99/Simple/Util.hs, dist/dist-sandbox-11467d12/build/Language/C99/Simple/Util.o )
[4 of 5] Compiling Language.C99.Simple.Translate ( src/Language/C99/Simple/Translate.hs, dist/dist-sandbox-11467d12/build/Language/C99/Simple/Translate.o )

src/Language/C99/Simple/Translate.hs:302:5: error:
    • No instance for (Control.Monad.Fail.MonadFail
                         Data.Functor.Identity.Identity)
        arising from a do statement
        with the failable pattern ‘(C.AbstractDeclrDirect ptr adeclr)’

Is it possible to express function pointers

For example something like this:

void *(*fptr)() = &bar;

where bar has the type void* bar(). I could not figure out how to express these types in the current data type Type.

Why doesn't the AST define an instance for `Eq`?

I just noticed that the AST does not define an instance for Eq.

It would be useful to be able to compare AST branches for equality (for example, to ensure you are not generating the same expression twice, or to be able to put declarations in a set). Is there a fundamental reason why it cannot or should not be done
?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.