CSci 658: Software Language Engineering
Fall 2013
Lecture Notes and Web Resources
Sections:
Reference Materials
- Free online
programming language textbooks and tutorials
- General Lua resources
- Course notes
by Fabio Mascarenhas for a course based on the PiL textbook.
- Official Lua language site:
[download ]
[documentation]
- Lua users site:
[wiki]
- Luarocks component site
- Lua Toolbox
- LuaMacro site
- Lua Snippets
- Tecgraf
PUC-Rio Libraries and Tools for Lua
- Kepler Project
- Key Lua papers and talks
- Roberto Ierusalimschy's slides for "Small is Beautiful: The
Design of Lua" [PDF
slides]
- Roberto Ierusalimschy, Luiz Henrique de Figueiredo, and
Waldemar Celes Filho. "Lua--An Extensible Extension Language,"
Software Experience and Practice 26 #6 (1996) 635-652:
[HTML]
- 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:
[PDF]
- 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:
[PDF]
- 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: [PDF]
- (SICP) Harold Abelson and Gerald J. Sussman with Julie
Sussman. Structure and Interpretation of Computer
Programs, Second Edition, MIT Press, 1996:
[book site at MIT Press]
[HTML book]
[SICP ebook site]
[local copy of source code]
- Code from functional programming textbooks
- Abelson and Sussman's classic SICP textbook Structure and
Interpretation of Computer Programs, Second Edition: [files]
- Simon Thompson's Haskell: The Craft of Functional
Programming, Third Edition, Addison Wesley, 2011: [files]
- Paul Hudak's The Haskell School of Expression: Learning
Functional Programming through Multimedia, Cambridge
University Press, 2000: [files]
- Domain-Specific Language (DSL) design and implementation
- Jon Bentley. "Programming Pearls: Little Languages,"
Communications of the ACM, Vol. 29, No. 8, pp. 711-721,
August 1986. [PDF]
- Martin Fowler's
blog articles on Domain-Specific Languages
- Martin Fowler (with Rebecca Parsons). Domain Specific
Languages, Addison Wesley, 2010: [DSL patterns catalog]
- Steve Freeman and Nat Pryce. "Evolving an Embedded
Domain-Specific Language in Java," In Companion to the 21st ACM
SIGPLAN Symposium on Object-Oriented Programming Systems, Languages,
and Applications (OOPSLA '06), ACM, New York, NY, USA,
855-865, 2006: [PDF]
- H. C. Cunningham. "A Little Language for Surveys: Constructing
an Internal DSL in Ruby," In Proceedings of the ACM SouthEast
Conference, 6 pages, March 2008: [manuscript] [presentation]
- Free online language design textbooks, tutorials, and code
- Shiram Krishnamurthi. Programming Languages: Application
and Interpretation, Second Edition:
[HTML]
[PDF]
[Fall 2012 course]
[Fall 2013 course]
- Source code for
interpreters in the the textbook: Samuel
N. Kamin. Programming Languages: An Interpreter-Based
Approach, Addison Wesley, 1990.
- Parsing Expression Grammars and LPEG library
- Roberto Ierusalimschy's LPeg: Parsing Expression Grammars For
Lua, version 0.12: [manual]
- Roberto Ierusalimschy's paper "A Text Pattern-Matching Tool
Based on Parsing Expression Grammars," Software: Practice &
Experience 39 #3 (2009) 221-258: [PDF]
- Roberto Ierusalimschy's talk LPEG: A New Approach to
Pattern Matching [PDF slides]
[video]
- Wikipedia entry on Parsing
Expression Grammar.
- Bryan Ford's paper "Parsing Expression Grammars: A
Recognition-Based Syntactic Foundation": [PDF
slides]
- LPEG Tutorial [HTML]
- LPEG Recipies
[HTML]
- Gavin Wraith's Around Pegs [HTML]
- Gavin Wraith's Parsing Expression Grammars [HTML]
- Dirk Laurie's Brief Introduction to LPEG
[HTML]
- Miscellaneous Lua software found and used by students in projects
- Busted unit
testing framework [docs]
- LOVE 2D game
framework
Examples and Lecture Notes
- (31 Aug - 03 Sept)
Lua Tutorial
- Natural number pacakge:
- (05 Sept) Natural number package in Lua
(nats.lua) inspired by Peano's Postulates.
- Revised version of package
(nats2.lua) (Better abstraction to hide data representation).
- (For reference) Similar programs in other languages:
[Java]
[Ruby]
[Scala (three versions, item 5)]
- Arithmetic Expression Tree program skeletons
Functional versions
- (05 Sept) Recursive
Functions with Record Representation (exprRecFuncRecord.lua)
- (12 Sept) Recursive
Functions with List Representation (exprRecFuncList.lua)
- (12 Sept) Evaluation
Function Table with List Representation (exprEvalTable.lua)]
- (For reference) Similar Scala code using case classes
Object-oriented versions
- (26 Sept, 1 Oct) Prototype
Object-Based (exprObjBased.lua)
- (1 Oct)
Object-Oriented with Inheritance (exprObjInherit.lua)
- (10 Sept) Notes on Recursion Concepts and Terminology
- Example functions from SICP
- (12 Sept) Square root (Newton's Method)
- (10 Sept) Factorial
- (10 Sept) Fibonacci
- (10 Sept) Exponentiation
- (12 Sept) Greatest common divisor
- (12 Sept) Summation
(takes function arguments)
- (12 Sept) Derivative
(returns function)
List Module
- (17-19 Sept) Cell-based list module:
[module source]
[test driver]
- (19 Sept) Closure-and-table-based list module variant:
[module source]
[test driver]
- (26 Sept, 1 Oct) Lazy list module variant using C reprocessor (cpp -P)
[module source]
[source after cpp]
[test driver]
[driver after cpp]
[sh script]
- (5 Nov) Lazy list module variant using
LuaMacro 2.5
[macro definitions]
[module macro source]
[source after luam -o]
[macro test driver]
[driver after luam -o]
[sh script]
- (developed after semester) Function-based cell list module variant:
[module source]
[test driver]
Notes on Data
Abstraction
- Note: Although we did not cover the Data Abstraction notes
explicitly, they are useful in understanding the instructor's approach
to developing modules.
Complex number arithmetic modules adapted from SICP Section 2.4. (Modules are
repeated in each package in which they are used.)
- (26 Sept) Rectangular coordinates modules
[arithmetic:]
[rectangular representation]
[utilities]
[test driver]
- (26 Sept) Polar coordinates modules:
[arithmetic]
[polar representation]
[utilities]
[test driver]
- (26 Sept) Tagged data modules:
[arithmetic]
[data tagging]
[utilities]
[test driver]
- (26 Sept) Data-directed programming modules:
[arithmetic]
[rectangular representation]
[polar representation]
[data tagging]
[utilities]
[test driver]
- (1 Oct) Object-oriented modules:
[arithmetic]
[utilities]
[test driver]
(26 Sept, 1-3 Oct)
Notes on Object-Oriented Programming
We discussed these notes through the section titled "An Object
Model".
- Note: Along with the discussion of these notes, we examined
the object-oriented versions of the Arithmetic Expression Tree and
Complex Number examples above and the Movabale and Named Object
example below.
Movable and Named Objects example (based on a similar Haskell
case study given in Section 14.6 of: Simon Thompson. Haskell:
The Craft of Functional Programming, Third Edition, Addison
Wesley, 2011.
- (3 Oct) First Lua version:
[source (movable.lua)]
- Modularized version with improved class support
[class_support module]
[using class-support (movable2.lua)]
[test driver (movable2Test.lua)]
- Other older versions:
[Haskell source ]
[Scala source (partial) ]
(8 Oct) Parsing arithmetic expression trees using LPEG (Lua Parsing
Express Grammar) library:
- Parser with captures
- Parser with
semantic actions
Lua versions similar to Martin Fowler's Lair Configuration
domain-specific language (DSL) examples from his book chapter "One Lair
and Twenty Ruby DSLs," Chapter 3, The ThoughtWorks
Anthology: Essays on Software Technology and Innovation, The
Pragmatic Bookshelf, 2008: [book site]
Note: The DSL patterns mentioned are from the DSL patterns catalog from
Martin Fowler's book Domain Specific Languages
(Addison Wesley, 2010:
Shared modules
- (15 Oct) Class support module (same as in Movable Objects case study)
[class support module (class_support.lua)]
- (15 Oct) Semantic Model
[model module (model.lua)]
[test driver (rules00.lua)]
Internal DSLs
- (15 Oct) Global Function Sequence
[builder module (builder08.lua)]
[dsl script (rules08.lua)]
[test driver (test08.lua)]
- (15 Oct) Class Method Function Sequence with Method Chaining
[builder module (builder11.lua)]
[dsl script (rules11.lua)]
[test driver (test11.lua)]
- (17 Oct) Expression Builder with Method Chaining
[builder module (builder14.lua)]
[dsl script (rules14.lua)]
[test driver (test14.lua)]
- (17 Oct) Nested Closures
[builder module (builder03.lua)]
[dsl script (rules03.lua)]
[test driver (test03.lua)]
- (17 Oct) Expression Builder with Object Scoping and Method Chaining
[builder module (builder17.lua)]
[dsl script (rules17.lua)]
[test driver (test17.lua)]
- (22 Oct) Literal Collection
[builder module (builder22.lua)]
[dsl script (rules22.lua)]
[test driver (test22.lua)]
External DSL
- (22 Oct) LPEG Parser/Builder (no corresponding example in Fowler paper)
[builder module (builderLPEG1.lua)]
[dsl script (rulesLPEG1.dsl)]
[test driver (testLPEG1.lua)]
Lua Parsing Expression Grammar (LPEG) library
- (24 Oct) Roberto Ierusalimschy's talk LPEG: A New Approach to
Pattern Matching [PDF slides]
[video]
- (For reference) Roberto Ierusalimschy's paper "A Text
Pattern-Matching Tool Based on Parsing Expression Grammars,"
Software: Practice & Experience 39 #3 (2009) 221-258: [PDF]
(5-19 Nov) Kamin Interpreters in Lua Toolset (KILT)
[Compressed tar file]
- Language/Interpreter-independent modules:
[REPL Module (repl.lua)]
[Environment Module (environment.lua)]
[Function Table Module (funtab.lua)]
[Utilities Module (utilities.lua)]
[Opcodes Factory Module (opcodes.lua)]
[Values Factory Module (values.lua) ]
[Parser Factory Module (parser.lua)]
[Evaluator Factory Module (evaluator.lua)]
-
Kamin Chapter 1 Core language interpreter:
[Core Interpreter (Core.lua)]
[Core Opcodes (opcodes_core.lua)]
[Core Values Module (values_core.lua)]
[Core Parser Module (parser_core.lua)]
[Core Evaluator Module
(evaluator_core.lua)
-
Kamin Chapter 2 Lisp language interpreter:
[Lisp Interpreter (Lisp.lua)]
[Lisp Opcodes (opcodes_lisp.lua)]
[Lisp Values Module (values_lisp.lua)]
[Lisp Parser Module (parser_lisp.lua)]
[Lisp Evaluator Module (evaluator_lisp.lua)
[A few Lisp examples]
-
Kamin Chapter 4 Scheme language interpreter:
[Scheme Interpreter (Scheme.lua)]
[Scheme Opcodes (opcodes_scheme.lua)]
[Scheme Values Module (values_scheme.lua)]
[Scheme Parser Module (parser_scheme.lua)]
[Scheme Evaluator Module
(evaluator_scheme.lua)
[A few Scheme examples]
(19-22 Nov exam, 3 Dec lecture) Sandwich DSL
- Semantic model
module (sandwich_model.lua)
- DSL builder module using
function sequence pattern (sandwich_builder.lua)
- Test driver
(test_sandwichDSL.lua)
(19-22 Nov exam, 3 Dec lecture) Carrie's Candy Bowl ADT
- Description of bag concept
- Hashed version
(candybowl_hash.lua). This file has a description of the problem
and the formal invariant, precondition, and postcondition
assertions.
- Unsorted list version
(candybowl_list.lua)
- Test driver
(test_candybowl.lua)
(Not discussed directly)
Notes on Functional Program
Evaluation Concepts
UP to CSci 658 root document?
Copyright © 2013, H. Conrad Cunningham
Last modified: Mon Sep 1 19:29:01 CDT 2014