Computer Science Graduate Students (and Faculty): I am changing the topic for my graduate course for Fall 2013. Instead of Engr 692-6 on Software Architecture and Design (using Scala), I plan to teach a course related to Programming Language Design and Implementation that will use the Lua programming language. Lua is a simple, but interesting, language widely used as an embedded language within applications such as security software and computer games. See below (or contact me) for more information about the course and language. I plan to teach the course under the new course CSci 658, Software Language Engineering. Once we get the new course created, we will move the students currently registered for Engr 692-6 to the new section. - H. Conrad Cunningham, Professor and Chair ----- CSci 658: Software Language Engineering Replaces CSci 692-6 Fall 2013, TuTh 4:00 p.m. Instructor: H. Conrad Cunningham Draft: 22 July 2013 C CATALOG DESCRIPTION (CSci 658) Study of topics on the design, implementation, use, and evolution of artificial languages for the engineering of software. Languages of interest include general-purpose programming languages, domain-specific languages, and modeling languages as well as application programming interfaces and collections of design patterns that implicitly define languages. INTRODUCTION Linguistic abstraction is at the core of computing science. As computing scientists, we should be able to solve problems and express the solutions in a variety of programming paradigms. We should understand how programming languages work. We should be able to design and implement simple languages to assist us in our work. This course seeks to deepen our understanding of the concepts and techniques for the design, implementation, and use of programming languages. It uses the dynamic application programming language Lua as both an object of study and a tool for implementing languages. I have not finalized the structure for this Fall 2013 offering, but I hope to explore many of the ideas discussed below. The course will involve programming assignments/projects related to programming language design and implementation and study of scholarly papers and other documents. LUA: AN EXTENSIBLE, MULTIPARADIGM PROGRAMMING LANGUAGE Lua is appropriate for this purpose. Its developers want to keep the core language simple but enable users to extend it by adding new features via host language (e.g., C) libraries. They also want to enable users to embed Lua functions and programs within host language applications. They want Lua to have an implementation that is small, efficient, and portable. To help achieve these goals, the Lua developers adopted the principle of separating mechanism from policy. That is, Lua provides "meta-mechanisms for implementing features, instead of providing a host of features directly in the language" [http://www.lua.org/about]. For example, Lua is not natively an object-oriented language, but its first-class functions, tables, and metatables enable several different implementations of classes and inheritance. We can study these different techniques--and perhaps design our own--to get a concrete understanding of how object-oriented languages work. Although Lua is primarily a procedural language, it supports programming in multiple paradigms. Its lexically scoped, first-class functions (closures) and tail recursion (tail call) elimination enable functional programming. Its closures, tables, and metatables enable both modular programming and object-oriented programming implementations. Its closures, first-class coroutines, and generic-for construct enable goal-directed programming. Its coroutines enable cooperative (nonpreemptive) multitasking natively. In combination with host language thread libraries, its coroutine and state maintenance facilities enable a variety of "shared-nothing" concurrent programming approaches to be implemented. Lua also supports language-oriented programming by means of its add-on LPEG text-processing/parsing library. LPEG provides a set of composable operators to parse languages defined by parsing expression grammars. This library is efficient and subsumes the functionality of regular expression processors. But it supports parsers for a class of languages similar to those definable by context-free grammars. Thus LPEG should enable the processing of small languages such as external domain-specific languages (DSLs). Lua should thus be effective for processing the simplified languages used in interpreter-based approaches to programming language organization courses. These languages are often Lisp-like languages using parentheses to specify the structure of the program expressions. We can use the implementation of such languages to help us explore programming language design and implementation concepts. Samuel Kamin's 1990 textbook [see reference below] examines a variety of programming languages by first building an interpreter for a core Lisp-like language and then modifying it to process languages with a similar syntax but differing semantics (meaning). It examines issues related to languages similar to Lisp, APL, Scheme, SASL (a precursor of the lazy functional language Haskell), CLU (a language using abstract data types using many concepts underlying contemporary object-oriented languages), Smalltalk, and Prolog. Although Kamin's languages were implemented in Pascal and C (and later in C++ by Timothy Budd), I recently (17-22 July 2013) developed a prototype of Kamin's core language interpreter in Lua using LPEG to build the parser. We can use this implementation (and others we may build) to study key concepts of programming language design and implementation. (Norman Ramsey of Tufts University is writing a textbook that updates Kamin's approach to teaching programming languages, but it will not be published until at least mid-2014.) Other interpreter-based approaches to teaching programming languages use Scheme as the implementation language. These include a book by Friedman, Wand, and Haynes and another by Krishnamurthi [see references]. COURSE GOALS The primary goal of this course is to allow the instructor and students to explore programming language design and implementation concepts in the context of the simple, but interesting, language Lua. A second goal is to help the instructor develop a future version of CSci 450 (Programming Language Organization) that uses Lua in a similar way. TOPICS (under development) Fundamental Lua concepts Functions and closures Functional programming Tables and metatables Implementing modules Implementing object-orientation LPEG library and parsing Implementing simple languages Coroutines and iterators Concurrency ... STUDENT OUTCOMES (under development) Upon successful completion of this course, students: know and understand the fundamental concepts and techniques of the Lua programming language can analyze a problem and synthesize a solution using functional programming techniques in Lua know and understand the concepts of tables and metatables and can implement object-oriented programming facilities in Lua know and understand the concepts of parsing expression grammars and the LPEG library and can use the library to implement simple languages know and understand the structure of interpreters and can modify or implement interpreters for simple languages know and understand the concepts of coroutines and can implement "concurrent" programs in Lua RECOMMENDED TEXTBOOK Robert Ierusalimshcy. Programming in Lua, Third Edition, Lua.org, Rio de Janiero, 2013. (Amazon's current price is $23.77.) LUA REFERENCE MATERIALS AND SOFTWARE Lua website: http://www.lua.org Lua Users website: http://lua-users.org Luarocks Lua module website: http://www.luarocks.org MoonRocks Lua module website: http://rocks.moonscript.org/ Lua 5.2 Reference Manual, Lua.org, 2013, online at http://www.lua.org/manual/5.2/. Lua-related papers and theses: http://www.lua.org/papers.html PROGRAMMING LANGUAGE REFERENCES Daniel P. Friedman and Mitchell Wand. Essentials of Programming Languages, Third Edition, MIT Press, 2008. Samuel N. Kamin. Programming Languages: An Interpreter- Based Approach, Addison Wesley, 1990. Shriram Krishnamurthi. Programming Languages: Application and Interpretation, Second Edition, 2012 (in work), available at http://cs.brown.edu/courses/cs173/2012/. EXAMPLE PAPERS Note: I have collected over 50 papers and documents in my Evernote folder for Lua-related issues. I have others on other programming language issues. Thais Vasconcelos Batista and Mauricio Vieira. "RE-AspectLua--Achieving Reuse in AspectLua." Journal of Universal Computer Science 13 #6 (2007) 786-805. Nelio Cacho, Thais Vasconcelos Batista, and Fabricio Fernandes. "AspectLua--A Dynamic AOP Approach." Journal of Universal Computer Science 11 #7 (2005) 1177-1197. Roberto Ierusalimschy. "A Text Pattern-Matching Tool Based on Parsing Expression Grammars," Software: Practice & Experience 39 #3 (2009) 221–258 Roberto Ierusalimschy. "Programming with Multiple Paradigms in Lua," In Proceedings the 18th International Workshop on Functional and Constraint Logic Programming (2009) 5–13. Roberto Ierusalimschy, Luiz Henrique de Figueiredo, and Waldemar Celes Filho. "Lua--An Extensible Extension Language," Software Experience and Practice 26 #6 (1996) 635-652, available online at http://www.lua.org/spe.html. Roberto Ierusalimschy, Luiz Henrique de Figueiredo, and Waldemar Celes Filho. "The Implementation of Lua 5.0," Journal of Universal Computer Science 11 #7 (2005) 1159–1176. Roberto Ierusalimschy, Luiz Henrique de Figueiredo, and Waldemar Celes Filho. "The Evolution of Lua," In Proceedings of ACM HOPL III (2007) 2-1–-2-26. Roberto Ierusalimschy, Luiz Henrique de Figueiredo, and Waldemar Celes Filho. "Passing a Language Through the Eye of a Needle," ACM Queue 9 #5 (May 2011) 20–29. Mark Joselli, Marcelo Zamith, Esteban Clua, Anselmo Montenegro, Regina Leal-Toledo, Aura Conci, Paulo Pagliosa, Luis Valente, and Bruno Feijo. 2010. "An Adaptative Game Loop Architecture with Automatic Distribution of Tasks Between CPU and GPU," ACM Computers in Entertainment 7 #4, Article 50 (January 2010), 15 pages. A. L. Moura and Roberto Ierusalimschy. "Revisiting Coroutines," ACM Transactions on Programming Languages and Systems 31 #2 (2009) 6.1–-6.31. Norman Ramsey. "ML Module Mania: A Type-Safe, Separately Compiled, Extensible Interpreter," Electronic Notes in Theoretical Computer Science 148 #2 (2006): 181-209. Alexandre Skyrme, Noemi de La Rocque Rodriguez, and Roberto Ierusalimschy. "Exploring Lua for Concurrent Programming," Journal of Universal Computer Science 14 #21 (2008) 3556-3572.