Program Analysis Scenarios in Rascal

  • Mark Hills
  • Paul Klint
  • Jurgen J. Vinju
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 7571)


Rascal is a meta programming language focused on the implementation of domain-specific languages and on the rapid construction of tools for software analysis and software transformation. In this paper we focus on the use of Rascal for software analysis. We illustrate a range of scenarios for building new software analysis tools through a number of examples, including one showing integration with an existing Maude-based analysis. We then focus on ongoing work on alias analysis and type inference for PHP, showing how Rascal is being used, and sketching a hypothetical solution in Maude. We conclude with a high-level discussion on the commonalities and differences between Rascal and Maude when applied to program analysis.


Abstract Syntax Parse Tree Type Inference Concrete Syntax Program Point 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Agesen, O.: The Cartesian Product Algorithm: Simple and Precise Type Inference of Parametric Polymorphism. In: Olthoff, W. (ed.) ECOOP 1995. LNCS, vol. 952, pp. 2–26. Springer, Heidelberg (1995)Google Scholar
  2. 2.
    Anderson, P., Zarins, M.: The CodeSurfer Software Understanding Platform. In: Proceedings of IWPC 2005, pp. 147–148. IEEE (2005)Google Scholar
  3. 3.
    Balland, E., Brauner, P., Kopetz, R., Moreau, P.-E., Reilles, A.: Tom: Piggybacking Rewriting on Java. In: Baader, F. (ed.) RTA 2007. LNCS, vol. 4533, pp. 36–47. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  4. 4.
    Bergstra, J., Heering, J., Klint, P.: Algebraic Specification. ACM Press (1989)Google Scholar
  5. 5.
    Beyer, D.: Relational programming with CrocoPat. In: Proceedings of ICSE 2006, pp. 807–810. ACM Press (2006)Google Scholar
  6. 6.
    Bravenboer, M., Kalleberg, K.T., Vermaas, R., Visser, E.: Stratego/XT 0.17. A language and toolset for program transformation. Science of Computer Programming 72(1-2), 52–70 (2008)MathSciNetCrossRefGoogle Scholar
  7. 7.
    Camphuijsen, P.: Soft typing and analyses of PHP programs. Master’s thesis, Universiteit Utrecht (2007)Google Scholar
  8. 8.
    Ceri, S., Gottlob, G., Tanca, L.: Logic programming and databases. Springer-Verlag New York, Inc. (1990)Google Scholar
  9. 9.
    Charles, P., Fuhrer, R.M., Sutton Jr., S.M., Duesterwald, E., Vinju, J.J.: Accelerating the Creation of Customized, Language-Specific IDEs in Eclipse. In: Proceedings of OOPSLA 2009, pp. 191–206. ACM Press (2009)Google Scholar
  10. 10.
    Chen, F., Roşu, G., Venkatesan, R.P.: Rule-Based Analysis of Dimensional Safety. In: Nieuwenhuis, R. (ed.) RTA 2003. LNCS, vol. 2706, pp. 197–207. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  11. 11.
    Clavel, M., Durán, F., Eker, S., Lincoln, P., Martí-Oliet, N., Meseguer, J., Talcott, C.: All About Maude - A High-Performance Logical Framework. LNCS, vol. 4350. Springer, Heidelberg (2007)zbMATHGoogle Scholar
  12. 12.
    Cordy, J.R.: The TXL source transformation language. Science of Computer Programming 61(3), 190–210 (2006)MathSciNetzbMATHCrossRefGoogle Scholar
  13. 13.
    Eker, S., Meseguer, J., Sridharanarayanan, A.: The Maude LTL Model Checker. In: Proceedings of WRLA 2002. ENTCS, vol. 71. Elsevier (2002)Google Scholar
  14. 14.
    Ellison, C., Roşu, G.: An Executable Formal Semantics of C with Applications. In: Proceedings of POPL 2012, pp. 533–544. ACM Press (2012)Google Scholar
  15. 15.
    Farzan, A., Chen, F., Meseguer, J., Roşu, G.: Formal Analysis of Java Programs in JavaFAN. In: Alur, R., Peled, D.A. (eds.) CAV 2004. LNCS, vol. 3114, pp. 501–505. Springer, Heidelberg (2004)CrossRefGoogle Scholar
  16. 16.
    Fowler, M., Beck, K., Brant, J., Opdyke, W., Roberts, D.: Refactoring: Improving the Design of Existing Code. Addison-Wesley (2000)Google Scholar
  17. 17.
    Gamma, E., Helm, R., Johnson, R.E., Vlissides, J.: Design Patterns. Elements of Reusable Object-Oriented Software. Addison-Wesley (1995)Google Scholar
  18. 18.
    Heering, J., Hendriks, P., Klint, P., Rekers, J.: The syntax definition formalism SDF - reference manual. SIGPLAN Notices 24(11), 43–75 (1989)CrossRefGoogle Scholar
  19. 19.
    Hills, M., Chen, F., Roşu, G.: A Rewriting Logic Approach to Static Checking of Units of Measurement in C. In: Proceedings of RULE 2008. Elsevier (2008) (to appear)Google Scholar
  20. 20.
    Hills, M., Şerbănuţă, T.F., Roşu, G.: A Rewrite Framework for Language Definitions and for Generation of Efficient Interpreters. In: Proceedings of WRLA 2006. ENTCS, vol. 176, pp. 215–231. Elsevier (2007)Google Scholar
  21. 21.
    Hills, M., Klint, P., van der Storm, T., Vinju, J.J.: A Case of Visitor versus Interpreter Pattern. In: Bishop, J., Vallecillo, A. (eds.) TOOLS 2011. LNCS, vol. 6705, pp. 228–243. Springer, Heidelberg (2011)CrossRefGoogle Scholar
  22. 22.
    Hills, M., Klint, P., Vinju, J.J.: RLSRunner: Linking Rascal with K for Program Analysis. In: Sloane, A., Aßmann, U. (eds.) SLE 2011. LNCS, vol. 6940, pp. 344–353. Springer, Heidelberg (2012)CrossRefGoogle Scholar
  23. 23.
    Hills, M., Klint, P., Vinju, J.J.: Scripting a Refactoring with Rascal and Eclipse. In: Proceedings of WDT 2012. ACM Press (to appear, 2012) Google Scholar
  24. 24.
    Hills, M., Roşu, G.: A Rewriting Logic Semantics Approach To Modular Program Analysis. In: Proceedings of RTA 2010. Leibniz International Proceedings in Informatics, vol. 6, pp. 151–160. Schloss Dagstuhl - Leibniz Center of Informatics (2010)Google Scholar
  25. 25.
    Hind, M., Burke, M.G., Carini, P.R., Choi, J.-D.: Interprocedural Pointer Alias Analysis. ACM TOPLAS 21(4), 848–894 (1999)CrossRefGoogle Scholar
  26. 26.
    Holt, R.C.: Grokking Software Architecture. In: Proceedings of WCRE 2008, pp. 5–14. IEEE (2008)Google Scholar
  27. 27.
    Huang, Y.-W., Yu, F., Hang, C., Tsai, C.-H., Lee, D.-T., Kuo, S.-Y.: Securing Web Application Code by Static Analysis and Runtime Protection. In: Proceedings of WWW 2004, pp. 40–52. ACM Press (2004)Google Scholar
  28. 28.
    Huang, Y.-W., Yu, F., Hang, C., Tsai, C.-H., Lee, D.T., Kuo, S.-Y.: Verifying Web Applications Using Bounded Model Checking. In: Proceedings of DSN 2004, pp. 199–208. IEEE (2004)Google Scholar
  29. 29.
    Jovanovic, N., Kruegel, C., Kirda, E.: Precise Alias Analysis for Static Detection of Web Application Vulnerabilities. In: Proceedings of PLAS 2006, pp. 27–36. ACM Press (2006)Google Scholar
  30. 30.
    Jovanovic, N., Krügel, C., Kirda, E.: Pixy: A Static Analysis Tool for Detecting Web Application Vulnerabilities (Short Paper). In: IEEE Symposium on Security and Privacy, pp. 258–263 (2006)Google Scholar
  31. 31.
    Klint, P.: Using Rscript for Software Analysis. In: Working Session on Query Technologies and Applications for Program Comprehension, QTAPC 2008 (2008)Google Scholar
  32. 32.
    Klint, P., van der Storm, T., Vinju, J.: RASCAL: A Domain Specific Language for Source Code Analysis and Manipulation. In: Proceedings of SCAM 2009, pp. 168–177. IEEE (2009)Google Scholar
  33. 33.
    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.) GTTSE 2009. LNCS, vol. 6491, pp. 222–289. Springer, Heidelberg (2011)CrossRefGoogle Scholar
  34. 34.
    Meseguer, J.: Conditional rewriting logic as a unified model of concurrency. Theoretical Computer Science 96(1), 73–155 (1992)MathSciNetzbMATHCrossRefGoogle Scholar
  35. 35.
    Meseguer, J., Roşu, G.: The rewriting logic semantics project. Theoretical Computer Science 373(3), 213–237 (2007)MathSciNetzbMATHCrossRefGoogle Scholar
  36. 36.
    Moreau, P.-E.: A choice-point library for backtrack programming. In: JICSLP 1998 Post-Conference Workshop on Implementation Technologies for Programming Languages based on Logic (1998)Google Scholar
  37. 37.
    Opdyke, W.F.: Refactoring Object-Oriented Frameworks. PhD thesis, University of Illinois at Urbana-Champaign (1992)Google Scholar
  38. 38.
    Opdyke, W.F., Johnson, R.E.: Refactoring: An aid in designing application frameworks and evolving object-oriented systems. In: Proceedings of Symposium on Object-Oriented Programming Emphasizing Practical Applications (1990)Google Scholar
  39. 39.
    Parr, T.: The Definitive ANTLR Reference: Building Domain-Specific Languages. Pragmatic Bookshelf (2007)Google Scholar
  40. 40.
    Riesco, A., Verdejo, A., Martí-Oliet, N.: A Complete Declarative Debugger for Maude. In: Johnson, M., Pavlovic, D. (eds.) AMAST 2010. LNCS, vol. 6486, pp. 216–225. Springer, Heidelberg (2011)CrossRefGoogle Scholar
  41. 41.
    Rimsa, A., d’Amorim, M., Pereira, F.M.Q.: Tainted Flow Analysis on e-SSA-Form Programs. In: Knoop, J. (ed.) CC 2011. LNCS, vol. 6601, pp. 124–143. Springer, Heidelberg (2011)CrossRefGoogle Scholar
  42. 42.
    Roşu, G., Chen, F.: Certifying Measurement Unit Safety Policy. In: Proceedings of ASE 2003, pp. 304–309. IEEE (2003)Google Scholar
  43. 43.
    Roşu, G., Şerbănuţă, T.F.: An Overview of the K Semantic Framework. Journal of Logic and Algebraic Programming 79(6), 397–434 (2010)MathSciNetzbMATHCrossRefGoogle Scholar
  44. 44.
    Schärli, N., Ducasse, S., Nierstrasz, O., Black, A.P.: Traits: Composable Units of Behaviour. In: Cardelli, L. (ed.) ECOOP 2003. LNCS, vol. 2743, pp. 248–274. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  45. 45.
    van den Bos, J., Hills, M., Klint, P., van der Storm, T., Vinju, J.J.: Rascal: From Algebraic Specification to Meta-Programming. In: Proceedings of AMMSE 2011. EPTCS, vol. 56, pp. 15–32 (2011)Google Scholar
  46. 46.
    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
  47. 47.
    van den Brand, M., de Jong, H., Klint, P., Olivier, P.: Efficient Annotated Terms. Software, Practice & Experience 30, 259–291 (2000)CrossRefGoogle Scholar
  48. 48.
    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)CrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2012

Authors and Affiliations

  • Mark Hills
    • 1
  • Paul Klint
    • 1
    • 2
  • Jurgen J. Vinju
    • 1
    • 2
  1. 1.Centrum Wiskunde & InformaticaAmsterdamThe Netherlands
  2. 2.INRIA Lille Nord EuropeFrance

Personalised recommendations