Wednesday, January 21, 2009

Compiler research: the next 50 years

Este post no tiene que ver directamente con LayerD pero me pareció interesante compartir algunas partes de un interesante artículo titulado "Compiler research: the next 50 years" de la respetada publicación "ACM communications volume 52 issue 2". Transcribo las partes que me parecieron más interesantes:


 

Today, compilers and highlevel languages are the foundation of the complex and ubiquitous software infrastructure that undergirds the global economy. It is no exaggeration to say that compilers and high-level languages are as central to the information age as semiconductor technology.

In the coming decade, 2010 to 2020, compiler research will play a critical role in addressing two of the major challenges facing the overall computer field: Cost of programming multicore processors and Security and reliability of complex software systems.

Cultural Shift

To address these challenges, the compiler community must change its current research model, which emphasizes small-scale individual investigator activities on one-off infrastructures. Complete compiler infrastructures are just too complex to develop and maintain in the academic research environment.

Exploiting large-scale parallel hardware will be essential for improving an application's performance or its capabilities in terms of execution speed and power consumption. The challenge for compiler research is how to enable the exploitation of the power of the target machine, including its parallelism, without undue programmer effort.

Enable the creation of compiler research centers. There are few large compiler research groups anywhere in the world today. At universities, such groups typically consist of a senior researcher and a few students, and their projects tend to be short term, usually only as long as a Ph.D. project. Meanwhile, the few industrial groups studying advanced compiler technology tend to focus on near-term solutions, even as the compilers, the programs they translate and analyze, and the target execution environments have increased in complexity. The result is that too much of today's compiler research focuses on narrow problems, ignoring the opportunity to develop revolutionary strategies requiring long-term commitment for their development and evaluation.

The computer science community has achieved notable success in developing novel compiler infrastructures, including: compiler front-end development; program-analysis frameworks for research in compilers; verification tools, security applications, and software-engineering tools; and virtual machine frameworks for both mainstream and special-purpose languages. Even if the GNU and industry-developed compilers were a useful infrastructure for research, development of new robust, easy-to-use infrastructures by the researchers who need them are critical for future advances. Not only is it important to support such research projects, the research community must recognize their academic merit.

Compiler courses must clearly demonstrate to students the extraordinary importance, range of applicability, and internal elegance of what is one of the most fundamental enabling technologies of computer science.

Knowledge of the power and limitations of compiler algorithms is valuable to all users of compilers, debuggers, and any tool built using compiler algorithms that encapsulate many, if not most, of the important program-analysis and transformation strategies necessary for performance and correctness. Therefore, learning about compiler algorithms leads to learning about program optimization and typical programming errors in a deep and rigorous manner. For these reasons, programmers with a solid background in compilers tend to excel in their profession.

Definitivamente sería bueno que todo programador alguna vez construya su propio lenguaje de juguete aunque más no sea. Hoy por hoy hay muchas herramientas como para que esto sea una tarea más de tener ganas que de saber mucho para construir algo sencillo. Claro, si se quiere avanzar para abarcar lenguajes completos la dificultad y tiempo necesario aumenta mucho pero sigue siendo como todo una cuestión de ponerle laburo. En este sentido LayerD puede ser usado muy bien como herramienta didáctica para enseñar sobre compiladores ya que escribir un lenguaje LayerD de alto nivel es una tarea que se puede automatizar con cosas como Bison o JavaCC, para la etapa intermedia se puede usar el compilador Zoe que nos librara de la tarea de tener que diseñar y construir un analizador semántico a mano (cosa que suele ser lo más "complicado/laborioso" de un compilador por no haber prácticamente herramientas). Si se desea alterar la semántica de Zoe se puede modificar el código fuente en casos de querer cambiar mucho la semántica, o simplemente escribir un par de extensiones con classfactorys para cambios o incorporaciones no tan drásticas. Finalmente la generación de código se puede usar o modificar alguno de los generadores de código Zoe que hay.

Ojala, como dice el artículo se le dé más importancia a la investigación en relación a compiladores y en la próxima década veamos avances emocionantes al respecto. Personalmente, opino que son mucho más importantes los cambios y avances a realizar en lo que respecta al diseño de lenguajes de alto nivel que lo relacionado a mejorar los generadores de código de bajo nivel. Si bien coincido en que la generación de código optimizado y eficiente es clave, también pienso que es mucho más favorable para la ciencia de la computación y la industria del software cada vez que se logra elevar el nivel de abstracción en el desarrollo de software. Los primeros compiladores no generaban código super optimizado, sin embargo la ventaja de poder programar en un nivel de abstracción más alto le garantizo el éxito a los compiladores. El éxito de entornos de ejecución como Java y .NET no fue porque sus primeros intérpretes fueran excelentes, sí por poseer la capacidad de facilitar el desarrollo y mantenimiento del software.