-- Initial arrayForth.cabal generated by cabal init.  For further 
-- documentation, see http://haskell.org/cabal/users-guide/

name:                array-forth
version:             0.2.1.4

synopsis:            A simple interpreter for arrayForth, the language used on GreenArrays chips.
description:         This is a package for working with arrayForth. This is a variant of Forth used by GreenArrays chips. This package contains an arrayForth simulator, two different representations of arrayForth programs and some utilities like parsing. 

                     It also supports synthesizing arrayForth programs using MCMC. The basic idea is to find arrayForth programs by taking a simple prior distribution of programs and using a randomized hill-climbing algorithm to find a program fulfilling certain tests.

license:             GPL-3
license-file:        LICENSE

author:              Tikhon Jelvis <tikhon@jelv.is>
maintainer:          Tikhon Jelvis <tikhon@jelv.is>

category:            Language
build-type:          Simple
cabal-version:       >=1.8

source-repository head
  type:           git
  location:       git://github.com/TikhonJelvis/array-forth.git

flag synthesis
  description:    build the mcmc synthesis demo app
  default:        False

flag chart
  description:    build the charting facilities for analyzing the synthesizer
  default:        False


library
  exposed-modules:     Language.ArrayForth.Core
                       Language.ArrayForth.Channel
                       Language.ArrayForth.Distance, 
                       Language.ArrayForth.Interpreter,
                       Language.ArrayForth.NativeProgram,
                       Language.ArrayForth.Opcode,
                       Language.ArrayForth.Parse,
                       Language.ArrayForth.Program,
                       Language.ArrayForth.Stack,
                       Language.ArrayForth.State,
                       Language.ArrayForth.Synthesis
  hs-source-dirs:      src
  build-depends:       base >=4.7 && <=5, 
                       array >=0.4,
                       mcmc-synthesis >=0.1.2.1, 
                       modular-arithmetic ==1.*,
                       MonadRandom ==0.1.*, 
                       OddWord >=1.0.0, 
                       split ==0.1.*, 
                       vector >=0.9 && <0.11

  GHC-options:         -Wall -funbox-strict-fields -rtsopts

executable mcmc-demo
  Main-is:             src/Main.hs

  if flag(synthesis)
      build-depends:       array-forth,
                           base >4.7 && <=5, 
                           mcmc-synthesis >=0.1.2.1, 
                           MonadRandom ==0.1.*,
                           optparse-applicative >=0.7 && <0.10
      GHC-options:         -Wall -rtsopts
  else 
      buildable:           False 

executable array-forth
  Main-is:             src/Run.hs

  build-depends:       array-forth,
                       base >4.7 && <=5,
                       split ==0.1.*,
                       vector >=0.9 && <0.11

  GHC-options:         -Wall -rtsopts

executable chart
  Main-is:             src/Chart.hs

  if flag(chart)
      build-depends:       array-forth,
                           base >4.7 && <=5,
                           Chart >=0.16 && <1.0,
                           mcmc-synthesis >=0.1.2.1,
                           MonadRandom ==0.1.*,
                           optparse-applicative >=0.7 && <0.10

      GHC-options:         -Wall -rtsopts -O2
  else
      buildable:           False

test-suite test-array-forth
  Type:                exitcode-stdio-1.0
  Main-is:             test/Language/ArrayForth/Test.hs

  build-depends:       array-forth,
                       base >4.7 && <=5,
                       HUnit >= 1 && < 2,
                       QuickCheck >= 2 && <3,
                       test-framework-hunit ==0.*,
                       test-framework-quickcheck2 ==0.*,
                       test-framework-th ==0.*