skip to main content
10.1145/1640134.1640148acmconferencesArticle/Chapter ViewAbstractPublication PagessplashConference Proceedingsconference-collections
research-article

The ruby intermediate language

Published:26 October 2009Publication History

ABSTRACT

Ruby is a popular, dynamic scripting language that aims to "feel natural to programmers" and give users the "freedom to choose" among many different ways of doing the same thing. While this arguably makes programming in Ruby easier, it makes it hard to build analysis and transformation tools that operate on Ruby source code. In this paper, we present the Ruby Intermediate Language (RIL), a Ruby front-end and intermediate representation that addresses these. RIL includes an extensible GLR parser for Ruby, and an automatic translation into an easy-to-analyze intermediate form. This translation eliminates redundant language constructs, unravels the often subtle ordering among side effecting operations, and makes implicit interpreter operations explicit. We also describe several additional useful features of RIL, such as a dynamic instrumentation library for profiling source code and a dataflow analysis engine. We demonstrate the usefulness of RIL by presenting a static and dynamic analysis to eliminate null pointer errors in Ruby programs. We hope that RIL's features will enable others to more easily build analysis tools for Ruby, and that our design will inspire the of similar frameworks for other dynamic languages.

References

  1. Alfred V. Aho, Ravi Sethi, and Jeffrey D. Ullman. Compilers: Principles, Techniques, and Tools. Addison Wesley, 1988. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Akim Demaille, Roland Levillain, and Benoît Sigoure. Tweast: a simple and effective technique to implement concrete-syntax ast rewriting using partial parsing. In Sung Y. Shin and Sascha Ossowski, editors, SAC, pages 1924--1929. ACM, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. David Flanagan and Yukihiro Matsumoto. The Ruby Programming Language. O'Reilly Media, Inc, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Michael Furr, Jong-hoon (David) An, and Jeffrey S. Foster. Profile-guided static typing for dynamic scripting languages. In Proceedings of the twenty fourth Annual Conference on Object-Oriented Programming Systems, Languages, and Applications, October 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Michael Furr, Jong-hoon (David) An, Jeffrey S. Foster, and Michael Hicks. Static Type Inference for Ruby. In OOPS Track, SAC, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Jong hoon (David) An, Avik Chaudhuri, and Jeffrey S. Foster. Static Typing for Ruby on Rails. In Proceedings of the 24th IEEE/ACM International Conference on Automated Software Engineering, Auckland, New Zealand, November 2009. To appear. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. IronRuby - Ruby implementation for the .net platform, May 2009. http://www.ironruby.net/.Google ScholarGoogle Scholar
  8. JRuby - Java powered Ruby implementation, February 2008. http://jruby.codehaus.org/.Google ScholarGoogle Scholar
  9. MacRuby - Ruby implementation built on top of the objective-c common runtime and garbage collector, May 2009. http://www.macruby.org/.Google ScholarGoogle Scholar
  10. Xavier Leroy. The Objective Caml system, August 2004.Google ScholarGoogle Scholar
  11. Yukihiro Matsumoto. Ruby Language Reference Manual, version 1.4.6 edition, February 1998. http://docs.huihoo.com/ruby/ruby-man-1.4/yacc.html.Google ScholarGoogle Scholar
  12. George C. Necula, Scott McPeak, S. P. Rahul, and Westley Weimer. CIL: Intermediate Language and Tools for Analysis and Transformation of C Programs. In CC, pages 213--228, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. NetBeans - integrated development environment with support for the Ruby language, May 2009. http://www.netbeans.org/.Google ScholarGoogle Scholar
  14. Emmanuel Onzon. dypgen User's Manual, January 2008.Google ScholarGoogle Scholar
  15. RadRails - Ruby on Rails authoring environment, May 2009. http://aptana.com/rails/.Google ScholarGoogle Scholar
  16. Martin C. Rinard, Cristian Cadar, Daniel Dumitran, Daniel M. Roy, Tudor Leu, and William S. Beebee. Enhancing server availability and security through failure-oblivious computing. In OSDI, pages 303--316, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Ruby Parser - Ruby parser written in pure Ruby, May 2009. http://parsetree.rubyforge.org/.Google ScholarGoogle Scholar
  18. Flog, Flay, and Heckle - Ruby source analysis tools, May 2009. http://ruby.sadi.st/.Google ScholarGoogle Scholar
  19. Bruce Stewart. An Interview with the Creator of Ruby, November 2001. http://www.linuxdevcenter.com/pub/a/linux/2001/11/29/ruby.html.Google ScholarGoogle Scholar
  20. Dave Thomas, Chad Fowler, and Andy Hunt. Programming Ruby: The Pragmatic Programmers' Guide. Pragmatic Bookshelf, 2nd edition, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Bill Venners. The Philosophy of Ruby: A Conversation with Yukihiro Matsumoto, Part I, September 2003. http://www.artima.com/intv/rubyP.html.Google ScholarGoogle Scholar
  22. Yaml: Yaml ain't markup language, July 2009. http://www.yaml.org/.Google ScholarGoogle Scholar
  23. Yarv bytecode table, May 2009. http://lifegoo.pluskid.org/upload/doc/yarv/yarv_iset.html.Google ScholarGoogle Scholar

Index Terms

  1. The ruby intermediate language

        Recommendations

        Comments

        Login options

        Check if you have access through your login credentials or your institution to get full access on this article.

        Sign in

        PDF Format

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader
        About Cookies On This Site

        We use cookies to ensure that we give you the best experience on our website.

        Learn more

        Got it!