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.
- Alfred V. Aho, Ravi Sethi, and Jeffrey D. Ullman. Compilers: Principles, Techniques, and Tools. Addison Wesley, 1988. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- David Flanagan and Yukihiro Matsumoto. The Ruby Programming Language. O'Reilly Media, Inc, 2008. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- Michael Furr, Jong-hoon (David) An, Jeffrey S. Foster, and Michael Hicks. Static Type Inference for Ruby. In OOPS Track, SAC, 2009. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- IronRuby - Ruby implementation for the .net platform, May 2009. http://www.ironruby.net/.Google Scholar
- JRuby - Java powered Ruby implementation, February 2008. http://jruby.codehaus.org/.Google Scholar
- MacRuby - Ruby implementation built on top of the objective-c common runtime and garbage collector, May 2009. http://www.macruby.org/.Google Scholar
- Xavier Leroy. The Objective Caml system, August 2004.Google Scholar
- 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 Scholar
- 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 Scholar
Digital Library
- NetBeans - integrated development environment with support for the Ruby language, May 2009. http://www.netbeans.org/.Google Scholar
- Emmanuel Onzon. dypgen User's Manual, January 2008.Google Scholar
- RadRails - Ruby on Rails authoring environment, May 2009. http://aptana.com/rails/.Google Scholar
- 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 Scholar
Digital Library
- Ruby Parser - Ruby parser written in pure Ruby, May 2009. http://parsetree.rubyforge.org/.Google Scholar
- Flog, Flay, and Heckle - Ruby source analysis tools, May 2009. http://ruby.sadi.st/.Google Scholar
- Bruce Stewart. An Interview with the Creator of Ruby, November 2001. http://www.linuxdevcenter.com/pub/a/linux/2001/11/29/ruby.html.Google Scholar
- Dave Thomas, Chad Fowler, and Andy Hunt. Programming Ruby: The Pragmatic Programmers' Guide. Pragmatic Bookshelf, 2nd edition, 2004. Google Scholar
Digital Library
- Bill Venners. The Philosophy of Ruby: A Conversation with Yukihiro Matsumoto, Part I, September 2003. http://www.artima.com/intv/rubyP.html.Google Scholar
- Yaml: Yaml ain't markup language, July 2009. http://www.yaml.org/.Google Scholar
- Yarv bytecode table, May 2009. http://lifegoo.pluskid.org/upload/doc/yarv/yarv_iset.html.Google Scholar
Index Terms
The ruby intermediate language
Recommendations
Metaprogramming in Ruby: a pattern catalog
PLOP '10: Proceedings of the 17th Conference on Pattern Languages of ProgramsModern programming languages provide extensive metaprogramming facilities. We understand metaprogramming as the utilization and modification of available language constructs and abstractions while staying inside the language. Metaprogramming requires a ...
The ruby intermediate language
DLS '09Ruby 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 ...
Profile-guided static typing for dynamic scripting languages
OOPSLA '09: Proceedings of the 24th ACM SIGPLAN conference on Object oriented programming systems languages and applicationsMany popular scripting languages such as Ruby, Python, and Perl include highly dynamic language constructs, such as an eval method that evaluates a string as program text. While these constructs allow terse and expressive code, they have traditionally ...







Comments