Skip to main content

Streamlining Control Flow Graph Construction with DCFlow

  • Conference paper
Book cover Software Language Engineering (SLE 2014)

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 8706))

Included in the following conference series:

Abstract

A control flow graph (CFG) is used to model possible paths through a program, and is an essential part of many program analysis algorithms. While programs to construct CFGs can be written in meta-programming languages such as Rascal, writing such programs is currently quite tedious. With the goal of streamlining this process, in this paper we present DCFlow, a domain-specific language and Rascal library for defining control flow rules and building control flow graphs. Control flow rules in DCFlow are defined declaratively, based directly on the abstract syntax of the language under analysis and a number of operations representing types of control flow. Standard Rascal code is then generated based on the DCFlow definition. This code makes use of the DCFlow libraries to build CFGs for programs, which can then be visualized or used inside program analysis algorithms. To demonstrate the design of DCFlow we apply it to Pico—a very simple imperative language—and to a significant subset of PHP.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Aho, A., Kernighan, B., Weinberger, P.: Awk - A Pattern Scanning and Processing Language. Software–Practice and Experience 9(4), 267–280 (1979)

    Article  MATH  Google Scholar 

  2. Allen, F.E.: Control Flow Analysis. In: Proceedings of a Symposium on Compiler Optimization, pp. 1–19. ACM, New York (1970)

    Chapter  Google Scholar 

  3. Basten, H.J.S., Klint, P.: DeFacto: Language-Parametric Fact Extraction from Source Code. In: Gašević, D., Lämmel, R., Van Wyk, E. (eds.) SLE 2008. LNCS, vol. 5452, pp. 265–284. Springer, Heidelberg (2009)

    Chapter  Google Scholar 

  4. Beyer, D., Noack, A., Lewerentz, C.: Simple and efficient relational querying of software structures. In: Proceedings of the 10th Working Conference on Reverse Engineering, pp. 216–225 (2003)

    Google Scholar 

  5. Beyer, D., Noack, A., Lewerentz, C.: Efficient relational calculation for software analysis. IEEE Transactions on Software Engineering 31(2), 137 (2005)

    Article  Google Scholar 

  6. Ekman, T., Hedin, G.: The JastAdd system - modular extensible compiler construction. Science of Computer Programming 69(1–3), 14–26 (2007)

    Article  MATH  MathSciNet  Google Scholar 

  7. Hills, M., Klint, P.: PHP AiR: Analyzing PHP Systems with Rascal. In: Proceedings of CSMR-WCRE 2014, pp. 454–457. IEEE (2014)

    Google Scholar 

  8. Hills, M., Klint, P., Vinju, J.J.: Meta-language Support for Type-Safe Access to External Resources. In: Czarnecki, K., Hedin, G. (eds.) SLE 2012. LNCS, vol. 7745, pp. 372–391. Springer, Heidelberg (2013)

    Chapter  Google Scholar 

  9. Holt, R.: Binary Relational Algebra Applied to Software Architecture. CSRI 345. University of Toronto (March 1996)

    Google Scholar 

  10. Izmaylova, A., Klint, P., Shahi, A., Vinju, J.J.: M3: An Open Model For Measuring Code Artifacts. Technical Report arXiv-1312.1188, CWI (December 2013)

    Google Scholar 

  11. Johnson, S.C.: Yacc: Yet Another Compiler-Compiler. Technical Report CS TR 32, Bell Labs (1975)

    Google Scholar 

  12. Jourdan, M., Parigot, D., Julié, C., Durin, O., Bellec, C.L.: Design, Implementation and Evaluation of the FNC-2 Attribute Grammar System. In: Proceedings of PLDI 1990, pp. 209–222 (1990)

    Google Scholar 

  13. Kats, L.C.L., Visser, E.: The Spoofax Language Workbench. In: OOPSLA 2010 Companion, pp. 237–238. ACM (2010)

    Google Scholar 

  14. Klint, P.: Using Rscript for Software Analysis. In: Working Session on Query Technologies and Applications for Program Comprehension, QTAPC 2008 (2008)

    Google Scholar 

  15. Klint, P., van der Storm, T., Vinju, J.: EASY Meta-programming with Rascal. In: Fernandes, J.M., Lämmel, R., Visser, J., Saraiva, J. (eds.) Generative and Transformational Techniques in Software Engineering III. LNCS, vol. 6491, pp. 222–289. Springer, Heidelberg (2011)

    Chapter  Google Scholar 

  16. Klint, P., van der Storm, T., Vinju, J.J.: RASCAL: A Domain Specific Language for Source Code Analysis and Manipulation. In: Proceedings of SCAM 2009, pp. 168–177. IEEE (2009)

    Google Scholar 

  17. Lesk, M.: Lex - a lexical analyzer generator. Technical Report CS TR 39, Bell Labs (1975)

    Google Scholar 

  18. Moonen, L.: Data Flow Analysis for Reverse Engineering. Master’s thesis, University of Amsterdam (1996)

    Google Scholar 

  19. Müller, H., Klashinsky, K.: Rigi – a system for programming-in-the-large. In: Proceedings of ICSE 1988, pp. 80–86 (April 1988)

    Google Scholar 

  20. Murphy, G., Notkin, D.: Lightweight source model extraction. In: Proceedings of FSE 1995, pp. 116–127. ACM Press, New York (1995)

    Google Scholar 

  21. Murphy, G.C., Notkin, D.: Lightweight Lexical Source Model Extraction. ACM TOSEM 5(3), 262–292 (1996)

    Article  Google Scholar 

  22. Paakki, J.: Attribute grammar paradigms - a high-level methodology in language implementation. ACM Computing Surveys 27(2), 196–255 (1995)

    Article  Google Scholar 

  23. Sloane, A.M.: Lightweight Language Processing in Kiama. In: Fernandes, J.M., Lämmel, R., Visser, J., Saraiva, J. (eds.) GTTSE 2009. LNCS, vol. 6491, pp. 408–425. Springer, Heidelberg (2011)

    Google Scholar 

  24. Söderberg, E., Ekman, T., Hedin, G., Magnusson, E.: Extensible intraprocedural flow analysis at the abstract syntax tree level. Science of Computer Programming 78(10), 1809–1827 (2013)

    Article  Google Scholar 

  25. van den Brand, M., Bruntink, M., Economopoulos, G., de Jong, H., Klint, P., Kooiker, T., van der Storm, T., Vinju, J.: Using The Meta-environment for Maintenance and Renovation. In: Proceedings of CSMR 2007, pp. 331–332. IEEE (2007)

    Google Scholar 

  26. den van Brand, M.G.J., van Deursen, A., Heering, J., de Jong, H.A., de Jonge, M., Kuipers, T., Klint, P., Moonen, L., Olivier, P.A., Scheerder, J., Vinju, J.J., Visser, E., Visser, J.: The ASF+SDF Meta-environment: A Component-Based Language Development Environment. In: Wilhelm, R. (ed.) CC 2001. LNCS, vol. 2027, pp. 365–370. Springer, Heidelberg (2001)

    Chapter  Google Scholar 

  27. Vankov, I.: Relational approach to program slicing. Master’s thesis, University of Amsterdam (2005)

    Google Scholar 

  28. Wachsmuth, G.H., Konat, G.D.P., Vergu, V.A., Groenewegen, D.M., Visser, E.: A Language Independent Task Engine for Incremental Name and Type Analysis. In: Erwig, M., Paige, R.F., Van Wyk, E. (eds.) SLE 2013. LNCS, vol. 8225, pp. 260–280. Springer, Heidelberg (2013)

    Chapter  Google Scholar 

  29. Wyk, E.V., Bodin, D., Gao, J., Krishnan, L.: Silver: An extensible attribute grammar system. Science of Computer Programming 75(1-2), 39–54 (2010)

    Article  MATH  MathSciNet  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2014 Springer International Publishing Switzerland

About this paper

Cite this paper

Hills, M. (2014). Streamlining Control Flow Graph Construction with DCFlow. In: Combemale, B., Pearce, D.J., Barais, O., Vinju, J.J. (eds) Software Language Engineering. SLE 2014. Lecture Notes in Computer Science, vol 8706. Springer, Cham. https://doi.org/10.1007/978-3-319-11245-9_18

Download citation

  • DOI: https://doi.org/10.1007/978-3-319-11245-9_18

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-319-11244-2

  • Online ISBN: 978-3-319-11245-9

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics