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.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
Aho, A., Kernighan, B., Weinberger, P.: Awk - A Pattern Scanning and Processing Language. Software–Practice and Experience 9(4), 267–280 (1979)
Allen, F.E.: Control Flow Analysis. In: Proceedings of a Symposium on Compiler Optimization, pp. 1–19. ACM, New York (1970)
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)
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)
Beyer, D., Noack, A., Lewerentz, C.: Efficient relational calculation for software analysis. IEEE Transactions on Software Engineering 31(2), 137 (2005)
Ekman, T., Hedin, G.: The JastAdd system - modular extensible compiler construction. Science of Computer Programming 69(1–3), 14–26 (2007)
Hills, M., Klint, P.: PHP AiR: Analyzing PHP Systems with Rascal. In: Proceedings of CSMR-WCRE 2014, pp. 454–457. IEEE (2014)
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)
Holt, R.: Binary Relational Algebra Applied to Software Architecture. CSRI 345. University of Toronto (March 1996)
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)
Johnson, S.C.: Yacc: Yet Another Compiler-Compiler. Technical Report CS TR 32, Bell Labs (1975)
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)
Kats, L.C.L., Visser, E.: The Spoofax Language Workbench. In: OOPSLA 2010 Companion, pp. 237–238. ACM (2010)
Klint, P.: Using Rscript for Software Analysis. In: Working Session on Query Technologies and Applications for Program Comprehension, QTAPC 2008 (2008)
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)
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)
Lesk, M.: Lex - a lexical analyzer generator. Technical Report CS TR 39, Bell Labs (1975)
Moonen, L.: Data Flow Analysis for Reverse Engineering. Master’s thesis, University of Amsterdam (1996)
Müller, H., Klashinsky, K.: Rigi – a system for programming-in-the-large. In: Proceedings of ICSE 1988, pp. 80–86 (April 1988)
Murphy, G., Notkin, D.: Lightweight source model extraction. In: Proceedings of FSE 1995, pp. 116–127. ACM Press, New York (1995)
Murphy, G.C., Notkin, D.: Lightweight Lexical Source Model Extraction. ACM TOSEM 5(3), 262–292 (1996)
Paakki, J.: Attribute grammar paradigms - a high-level methodology in language implementation. ACM Computing Surveys 27(2), 196–255 (1995)
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)
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)
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)
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)
Vankov, I.: Relational approach to program slicing. Master’s thesis, University of Amsterdam (2005)
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)
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)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights 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)