Central European Functional Programming School pp 402-439

Part of the Lecture Notes in Computer Science book series (LNCS, volume 7241) | Cite as

Feldspar: Application and Implementation

  • Emil Axelsson
  • Mary Sheeran

Abstract

The Feldspar project aims to develop a domain specific language for Digital Signal Processing algorithm design. From functional descriptions, imperative code (currently C) is generated. The project partners are Ericsson, Chalmers and ELTE, Budapest. The background and motivation for the project have been documented elsewhere [3]. We aim to raise the level of abstraction at which algorithm developers and implementors work, and to generate, from Feldspar descriptions, the kind of code that is currently written by hand.

These lecture notes first give a brief introduction to Feldspar and the style of programming that it encourages. Next, we document the implementation of Feldspar as a domain specific language (DSL), embedded in Haskell. The implementation is built using a library called Syntactic that was built for this purpose, but also designed to be of use to other implementors of embedded domain specific languages. We show the implementation of Feldspar in sufficient detail to give the reader an understanding of how the use of the Syntactic library enables the modular construction of an embedded DSL. For those readers who would like to apply these techniques to their own DSL embedded in Haskell, further instructions are given in section 5.

The programming examples are available in the CEFP directory of the Feldspar package, version 0.5.0.1:

http://hackage.haskell.org/package/feldspar-language-0.5.0.1

The code can be fetched by running:

> cabal unpack feldspar-language-0.5.0.1

All code is written in Haskell, and has been tested using the Glasgow Haskell Compiler (GHC), version 7.0.2, and the packages

  • syntactic-0.8

  • feldspar-language-0.5.0.1

  • feldspar-compiler-0.5.0.1

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Syntactic library, version 0.8, http://hackage.haskell.org/package/syntactic-0.8
  2. 2.
    Axelsson, E., Claessen, K., Sheeran, M., Svenningsson, J., Engdal, D., Persson, A.: The Design and Implementation of Feldspar- An Embedded Language for Digital Signal Processing. In: Hage, J., Morazán, M.T. (eds.) IFL 2010. LNCS, vol. 6647, pp. 121–136. Springer, Heidelberg (2011)CrossRefGoogle Scholar
  3. 3.
    Axelsson, E., Claessen, K., Dévai, G., Horváth, Z., Keijzer, K., Lyckegård, B., Persson, A., Sheeran, M., Svenningsson, J., Vajda, A.: Feldspar: A Domain Specific Language for Digital Signal Processing algorithms. In: 8th ACM/IEEE International Conference on Formal Methods and Models for Codesign (MEMOCODE 2010), pp. 169–178. IEEE Computer Society (2010)Google Scholar
  4. 4.
    Batcher, K.E.: Sorting networks and their applications. In: AFIPS Spring Joint Computing Conference, pp. 307–314 (1968)Google Scholar
  5. 5.
    Bjesse, P., Claessen, K., Sheeran, M., Singh, S.: Lava: Hardware Design in Haskell. In: ICFP 1998: Proceedings of the Third ACM SIGPLAN International Conference on Functional Programming, pp. 174–184. ACM (1998)Google Scholar
  6. 6.
    Carette, J., Kiselyov, O., Shan, C.: Finally tagless, partially evaluated: Tagless staged interpreters for simpler typed languages. Journal of Functional Programming 19(05), 509–543 (2009)MathSciNetCrossRefMATHGoogle Scholar
  7. 7.
    Claessen, K., Sheeran, M., Svensson, B.J.: Expressive array constructs in an embedded GPU kernel programming language. In: Proceedings of the 7th Workshop on Declarative Aspects and Applications of Multicore Programming, DAMP 2012, pp. 21–30. ACM (2012)Google Scholar
  8. 8.
    Cooley, J.W., Tukey, J.W.: An algorithm for the machine calculation of complex Fourier series. Math. Comp. 19, 297–301 (1965)MathSciNetCrossRefMATHGoogle Scholar
  9. 9.
    Dévai, G., Tejfel, M., Gera, Z., Páli, G., Nagy, G., Horváth, Z., Axelsson, E., Sheeran, M., Vajda, A., Lyckegård, B., Persson, A.: Efficient code generation from the high-level domain-specific language Feldspar for DSPs. In: ODES-8: 8th Workshop on Optimizations for DSP and Embedded Systems (2010)Google Scholar
  10. 10.
    Duhamel, P., Vetterli, M.: Fourier Transforms: A Tutorial Review and a State of the Art. In: Madisetti, V.K., Williams, D.B. (eds.) Digital Signal Processing Handbook. CRC Press LLC (1999)Google Scholar
  11. 11.
    Elliott, C., Finne, S., de Moor, O.: Compiling embedded languages. Journal of Functional Programming 13(3), 455–481 (2003)CrossRefMATHGoogle Scholar
  12. 12.
    Gill, A.: Type-safe observable sharing in Haskell. In: Haskell 2009: Proceedings of the 2nd ACM SIGPLAN Symposium on Haskell, pp. 117–128. ACM (2009)Google Scholar
  13. 13.
    Hudak, P.: Modular domain specific languages and tools. In: ICSR 1998: Proceedings of the 5th International Conference on Software Reuse, pp. 134–142. IEEE Computer Society Press (1998)Google Scholar
  14. 14.
    Keller, G., Chakravarty, M.M.T., Leshchinskiy, R., Peyton Jones, S., Lippmeier, B.: Regular, shape-polymorphic, parallel arrays in Haskell. In: Proceedings of the 15th ACM SIGPLAN International Conference on Functional Programming, ICFP 2010, pp. 261–272. ACM (2010)Google Scholar
  15. 15.
    Persson, A., Axelsson, E., Svenningsson, J.: Generic Monadic Constructs for Embedded Languages. In: IFL 2011: 23rd International Symposium on Implementation and Application of Functional Languages. LNCS, vol. 7257. Springer, Heidelberg (2012)Google Scholar
  16. 16.
    Schrijvers, T., Peyton Jones, S., Sulzmann, M., Vytiniotis, D.: Complete and decidable type inference for GADTs. In: Proc. 14th ACM SIGPLAN International Conference on Functional Programming, pp. 341–352. ACM (2009)Google Scholar
  17. 17.
    Swierstra, W.: Data types à la carte. Journal of Functional Programming 18(04), 423–436 (2008)MathSciNetCrossRefMATHGoogle Scholar
  18. 18.
    Wadler, P.: The expression problem (1998), http://www.daimi.au.dk/~madst/tool/papers/expression.txt

Copyright information

© Springer-Verlag Berlin Heidelberg 2012

Authors and Affiliations

  • Emil Axelsson
    • 1
  • Mary Sheeran
    • 1
  1. 1.CSE Dept.Chalmers University of TechnologySweden

Personalised recommendations