CSci 658-01: Software Language Engineering
Spring 2018 Lecture Notes

H. Conrad Cunningham

12 February 2018 (after class)

Copyright (C) 2018, H. Conrad Cunningham

Professor of Computer and Information Science
University of Mississippi
211 Weir Hall
P.O. Box 1848
University, MS 38677
(662) 915-5358

I maintain these notes as text in the Pandoc’s dialect of Markdown using embedded LaTeX markup for the mathematical formulas and then translate the notes to HTML, PDF, and other formats as needed.

Advisory: The HTML version of this document requires use of a browser that supports the display of MathML. A good choice as of February 2018 is a recent version of Firefox from Mozilla.

Lecture Notes

Go To Current Lecture

Schedule, Notes, and Examples

  1. (22 Jan) Review syllabus. Distribute papers to be discussed over next two weeks.

  2. (24, 26 Jan) Discuss “Little Languages” paper and related issues

    Jon Bentley. Programming Pearls: Little Languages, Communications of the ACM, Vol. 29, No. 8, pp. 711-721, August 1986.

    Instructor’s note on pic: On my iMac, I installed (using Homebrew) the groff package, which includes the GNU pic implementation. (I also installed the plotutils package to help with display in various formats.)

    Additional references for little language pic (not discussed)

    1. Brian W. Kernighan. PIC -- A Graphics Language for Typesetting, Revised User Manual, Computing Science Technical Report No. 116, Bell Laboratories, December 1984. [local]
    2. Eric S. Raymond. Making Pictures with GNU PIC, August 1995.
    3. Philipp K. Janert. In Praise of Pic, ONLamp.com, O'Reilly Media, June 2007, Retrieved 24 January, 2018.
    4. W. Richard Stevens. Examples of pic Macros, Retrieved from http://www.kohala.com/start/ (troff resources, pic), 24 January 2018. [pic source]

    Additional references for little graph language dot and the GraphViz package (not discussed)

    1. GraphViz -- Graph Visualization Software, Retrieved 26 January 2018.

    Additional references for the little languages lex, yacc, make, and chem (not discussed)

    1. Jon L. Bentley, Lynn W. Jelinski, and Brian W. Kernighan. Chem – A Program for Phototypesetting Chemical Structure Diagrams, AT&T Bell Laboratories, Murray Hill, NJ 07974, U.S.A.
    2. Stuart I. Feldman. Make – A Program for Maintaining Computer Program, Software: Practice and Experience, Vol. 9, no. 4 pp. 255-265, 1979.
    3. Stephen C. Johnson. Yacc: Yet Another Compiler-Compiler, Vol. 32. Murray Hill, NJ: Bell Laboratories, 1975.
    4. Michael E. Lesk and Eric Schmidt. Lex: A Lexical Analyzer Generator, Bell Laboratories Murray Hill, NJ, 1975.
    5. Learn X in Y Minutes, Where X = make (GNU)
  3. (26, 29 Jan) Discuss “No Silver Bullet” paper and related issues

    Frederick P. Brooks. No Silver Bullet: Essence and Accident in Software Engineering, IEEE Computer, Vol. 20, No. 4, 10-19, 1987.

  4. (29, 31 Jan) Discuss “Language-Oriented Programming” paper

    M. P. Ward. Language-Oriented Programming, Software–Concepts and Tools, Vol. 15, No. 4, pp. 147-161, 1994. [local]

    Other references from paper (not discussed)

    1. Charles Antony Richard Hoare. The Emperor’s Old Clothes (1980 Turing Award Address), Communications of the ACM, Vol. 24, No. 2, 75-83, 1981.

  5. (31 Jan; 2, 5, 14 Feb) Discuss Domain Specific Languages notes and related issues

    References used in notes (not discussed directly)

    1. Martin Fowler. Using Domain-Specific Languages, Chapter 2, Domain-Specific Languages, Addison Wesley, 2011.
    2. Steve Freeman and Nat Pryce. Evolving an Embedded Domain-Specific Language in Java, In Proceedings of the ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA), 12 pages, 2006. [local]
    3. Gabor Karsai, Holger Krahn, Claas Pinkernell, Bernhard Rumpe, Martin Schindler and Steven Voelkel. Design Guidelines for Domain Specific Languages, In Proceedings of OOPSLA Workshop on Domain-Specific Modeling, 2009. Also arXiv preprint arXiv:1409.2378, 2014. [local]
    4. M. Mernik, J. Heering, and A. M. Sloane. When and How to Develop Domain Specific Languages, ACM Computing Surveys, 37(4):316-344, December 2005. [local]
  6. (5, 14 Feb) Discuss Fowler’s introductory DSL example

    Martin Fowler. An Introductory Example, Chapter 1, Domain-Specific Languages, Addison Wesley, 2011.

  7. Survey Design Patterns (see dates on items)

    1. (5, 7 Feb) Introduction to Patterns [HTML slides]

    2. (7 Feb) Pipes and Filters Architectural Pattern (Not fully covered, used mainly to illustrate approach to pattern definition) [Powerpoint]

    3. (9, 12 Feb) John Vlissides. Designing with Patterns, In Pattern Hatching: Design Patterns Applied, Addison-Wesley, 1998. [slides]

    4. Additional references from instructor’s notes (not directly disucssed in class)

    5. Additional references (mentioned in class, but not discussed in depth)

      • [Siemens book] Frank Buschmann, Regine Meunier, Hans Rohnert, Peter Sommerlad, and Michael Stal. Pattern-Oriented Software Architecture: A System of Patterns, Wiley, 1996.
      • [“Gang of Four” (GoF) book] Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides. Design Patterns: Elements of Reusable Object-Oriented Software, Addison Wesley, 1995. Patterns*, Wiley, 1996.
      • Mary Shaw. Some Patterns for Software Architecture, In John M. Vlissides, James O. Coplien, and Norman L. Kerth, editors, Pattern Languages of Program Design 2, Addison Wesley, 1996, pages 255-270. [local]
  8. Reference material possibly useful at this point (may discuss explicitly later if needed)

    1. Python 3

    2. Scala

    3. Object-oriented software development

    4. Free online programming language textbooks and tutorials

  9. (2, 5, 14 Feb) Discuss State Machine DSLs based on Martin Fowler’s Secret Panel Controller (State Machine) DSLs

    Caveat: I developed the Scala versions in 2009 by referring to an in-work version of Fowler’s book on his website, so they may not follow his final book precisely. Fowler’s code is in Scala, Ruby, C#, etc. I updated the Scala programs in 2018 to make sure they would compile under the current Scala.

    1. Background: Martin Fowler. Domain Specific Languages, Addison Wesley, 2011.

      • Fowler introduces the Secret Panel Controller (State Machine) case study in Chapter 1 (An introductory example) It is an example running through several of the 57 chapters of the book.

      • Martin Fowler’s List of DSL Patterns from Domain Specific Languages, Addison Wesley, 2011

      Scala versions (2009)

    2. Scala State Machine Semantic Model (Ch. 1, 3, 11)

    3. Scala XML-based External DSL (Ch. 1, 3, 5)

    4. Scala Custom External DSL with a Delimiter-Directed parser (Ch. 1, 3, 5, 17)

    5. Scala Custom External DSL with hand-coded Ad Hoc Recursive-Descent parser (Ch. 1, 3, 5, 21)

    6. Scala Custom External DSL (using Scala parser combinator library) with embedded state machine builder (Ch. 1, 3, 5, 22)

    7. Scala Custom External DSL (using Scala parser combinator library) with full AST construction (Ch. 1, 3, 5, 22)

    8. Scala Static C Code Generator with Model-Aware target platform library (Ch. 1, 3, 5, 8, 52, 55)

  10. (5, 14 Feb) Discuss Fowler’s Computer Configuration Internal DSLs (Ch. 4, 35, 36, 38)

    1. Background: Martin Fowler. Domain Specific Languages, (Addison Wesley, 2011).

      Scala versions (2009)

    2. Scala semantic model (shared)

    3. Scala internal DSL using Method Chaining

    4. Scala internal DSL using Nested Closures and Object Scoping

    5. CompConfig.sh test script

  11. (TBD) Discuss Fowler’s Email Message Building Internal DSL (Ch. 35)

    1. Background: Martin Fowler. Domain Specific Languages, (Addison Wesley, 2011).

      Scala versions (2009)

    2. Scala internal DSL using Method Chaining and Progressive Interfaces

    3. EmailProgressive.sh test script

  12. (assigned, not discussed yet, TBD) Discuss Coplien’s SCV paper

    James Coplien, Daniel Hoffman, and David Weiss. Commonality and Variability in Software Engineering, IEEE Software, Vol. 15, No. 6, November 1998.

Materials under Phase 2 Reconstruction

  1. (TBD) Domain Modeling slides, for course registration system example.

  2. (TBD) Mark Ardis, Nigel Daley, Daniel Hoffman, Harvey Siy, and David Weiss. Software Product Lines: A Case Study, Software Practice and Experience, Vol. 30, No. 7, pp. 825-847, 2000.

  3. (TBD) S. Thibault, R. Marlet, and C. Consel. Domain-Specific Languages: From Design to Implementation–Application to Video Device Drivers Generation. IEEE Transactions on Software Engineering, 25(3):363–377, May/June 1999.

  4. (TBD) Ralph E. Johnson and Brian Foote. Designing Reusable Classes, Journal of Object-Oriented Programming, Vol. 1, No. 2, pages 22-35, June/July 1988.

  5. (TBD) Develop a Survey DSL

    1. Background: H. Conrad Cunningham. A Little Language for Surveys: Constructing an Internal DSL in Ruby, In Proceedings of the ACM SouthEast Conference, 6 pages, March 2008.

    2. Ruby source code (2006, 2008)

  6. (reference material on Lua, from Fall 2016 CSci 450 notes)

    1. Reference: Roberto Ierusalimshcy. Programming in Lua, Fourth Edition, Lua.org, Rio de Janiero, Brazil, 2016. The First Edition of this book is available online at https://www.lua.org/pil/contents.html; it covers Lua 5.0.

    2. Background: The slides below are adapted, in part, from Programming in Lua, Slides for Course by Fabio Mascarenhas from the Federal University of Rio de Janeiro, Brazil. He taught a course, which used Lua 5.2, at Nankai University, P. R. China, in July 2013.

    3. Introduction to Lua slides based, in part, on Mascarenhas slide sets 0-5

    4. Advanced Lua Functions slides based, in part, on Mascarenhas slide set 6

    5. Modules in Lua slides based, in part, on Mascarenhas slide set 9

    6. Lua Metatables slides based, in part, on Mascarenhas slide set 10

    7. Lua Objects slides based, in part, on Mascarenhas slide set 11

  7. (TBD) Discuss Fowler’s Lair Configuration DSL

    Caveat: Some of these DSL programs may depend upon features from Lua 5.1 that were changed in Lua 5.2 and 5.3.
    1. Background:

      Lua versions (2013)

    2. Lua shared modules

    3. Lua internal DSLs

    4. Lua external DSLs

  8. (TBD) Discuss Fowler’s DSL Reader framework

    1. Background:

      Ruby DSLs (2006)

    2. Ruby shared modules

    3. Ruby direct configuration and testing of Reader

    4. Ruby single-pass external text DSL

    5. Ruby two-pass external XML DSL

    6. Ruby internal DSL

  9. (TBD) Sandwich DSL Case Study

    1. Haskell version (2017)

    2. Scala version (2016)

    3. Lua version (simpler, 2013)

  10. (TBD) Abstract data types and modular design

    1. Background: Abstract data types

      • Nell Dale and Henry Walker. Abstract specification techniques, Chapter 1, In Abstract Data Types: Specifications, Implementations, and Applications, pp. 1-34,D. C. Heath, 1996.

      • H. Conrad Cunningham, Yi Liu, and Jingyi Wang. Designing a flexible framework for a table abstraction, Chapter 13 in Y. Chan, J. Talburt, and T. Talley, editors, Data Engineering: Mining, Information, and Intelligence, pp. 279-314, Springer, 2010.
        [manuscript] [slides]

    2. Modular Design

    3. Data Abstraction: [slides]

    4. (OO reference materia, repeated from abovel) Object-Oriented Software Development

    5. (Programming paradigms reference material, repeated from above) Programming Paradigms

    6. William R. Cook. On understanding data abstraction revisited. In Proceedings of OOPSLA, October 2009.
      [local]

    7. K. H. Britton, R. A. Parker, and D. L. Parnas. A procedure for designing abstract interfaces for device interface modules, In Proceedings of the 5th International Conference on Software Engineering, pp. 195-204, March 1981.

    8. D. L. Parnas. On the criteria to be used in decomposing systems into modules, Communications of the ACM, Vol. 15, No. 12, pp. 1053-1058, 1972.

    9. D. L. Parnas. On the design and development of program families, IEEE Transactions on Software Engineering, Vol. SE-2, No. 1, pp. 1-9, March 1976.

    10. D. L. Parnas. Designing software for ease of extension and contraction, IEEE Transactions on Software Engineering, Vol. SE-5, No. 1, pp. 128-138, March 1979.

    11. D. L. Parnas, P. C. Clements, and D. M. Weiss. The modular structure of complex systems, IEEE Transactions on Software Engineering, Vol. SE-11, No. 3, pp. 259-266, March 1985.

Materials under Phase 1 Reconstruction

  1. (TBD) Examine the CookieJar ADT case study (in Scala)

    1. Cookie Jar ADT Problem Description

    2. Specification concepts and notation – from Candy Bowl ADT description

    3. Immutable CookieJar ADT Implementation in Scala (ICookieJar) – uses method chaining functional style with immutable objects

    4. Mutable CookieJar ADT Implementation in Scala (CookieJar) – uses object-oriented style with mutable state

    5. Similar specification and Ruby program

  2. (TBD) Examine Carrie’s Candy Bowl ADT (abstract data type) case study

    1. Lua

    2. Scala

  3. (TBD) Examine the Labeled Digraph case study

    1. Background:

      • Nell Dale and Henry Walker. “Directed Graphs or Digraphs,” Chapter 10, In Abstract Data Types: Specifications, Implementations, and Applications, pp. 439-469, D. C. Heath, 1996.

      • Conrad Barski. “Building a Text Game Engine,”, Chapter 5, In Land of Lisp: Learn to Program in Lisp, One Game at a Time, pp. 69-84, No Starch Press, 2011.

        The Common Lisp example in this chapter is similar to the classic Adventure game; the underlying data structure is a labeled digraph.

    2. Haskell solutions (2015)

    3. Elixir solutions (2015)

    4. Scala solutions (2016)

    5. Using the Elixir Digraph ADT module to build the Wizard’s Adventure game (2015)

  4. (TBD) Parsing Expression Grammars

    1. Wikipedia entry on Parsing Expression Grammar

    2. Bryan Ford. Parsing Expression Grammars: A recognition-based syntactic foundation.
      [slides]

  5. (TBD) Doug Rosenberg with Kendall Scott. “Domain Modeling,” Chapter 2 in Use Case Driven Object Modeling with UML, Addison Wesley 1999.

  6. (TBD) Doug Rosenberg with Kendall Scott. “Use Case Modeling,” Chapter 3 in Use Case Driven Object Modeling with UML, Addison Wesley 1999.

  7. (TBD) Reference: Alistair Cockburn. “Introduction,” Chapter 1 in Writing Effective Use Cases, Addison-Wesley, 2001.

  8. (TBD) Understanding Inheritance, based on Timothy Budd’s Understanding Object-Oriented Programming with Java, Chapter 8:
    [slides]

  9. (TBD) Simple, silly Employee hierarchy example

    1. Scala (2008, 2010)

    2. Ruby (2006)

  10. (TBD) Examine a natural number arithmetic package

    This case study has implementations in four different languages (with some slight differences among the examples). So it can be used to compare implementations in different languages.

    1. Background on Peano arithmetic

    2. Background on software design patterns

    3. Lua version (2013)

    4. Elixir version (2015)

    5. Scala versions (2012, 2016)

    6. Ruby version (2006)

    7. Java version (2004, 2016), simpler, no generics

  11. (TBD) Software Reuse, based on Timothy Budd’s Understanding Object-Oriented Programming with Java, Chapter 10:
    ]slides]

  12. (TBD) Replacement and Refinement, loosely based on Timothy Budd’s An Introduction to Object-Oriented Programming, Third Edition, Section 16.2:
    [slides]

  13. (TBD) Implications of Inheritance, based on Timothy Budd’s Understanding Object-Oriented Programming with Java, Chapter 11:
    [slides]

  14. (TBD) Multiple Inheritance, based on Timothy Budd’s An Introduction to Object-Oriented Programming, Third Edition, Chapter 13:
    [slides]

  15. (TBD) Polymorphism, based on Timothy Budd’s Understanding Object-Oriented Programming with Java, Chapter 12:
    [slides]

  16. (TBD) Second Look at Classes, loosely based on Timothy Budd’s An Introduction to Object-Oriented Programming, Chapter 25 on Reflection and Introspection:
    [slides]

  17. (TBD) Frameworks, based on Timothy Budd’s An Introduction to Object-Oriented Programming, Third Edition, Chapter 21.

    1. Simple Sorting Framework in Scala

    2. Ice Cream Store discrete event simulation

  18. (TBD) Scala Divide-and-Conquer Framework, similar to the Java framework in the paper:

    H. C. Cunningham, Y. Liu, and C. Zhang. Using classic problems to teach Java framework design, Science of Computer Programming, Special Issue on Principles and Practice of Programming in Java (PPPJ 2004), Vol. 59, No. 1-2, pp. 147-169, January 2006. doi: 10.10.16/j.scico.2005.07.009. [manuscript]

    Note: The above paper was not discussed in class, but the Scala versions of the Divide-and-Conquer (immediately below) and Binary Tree Traversal (farther down on this page) frameworks were discussed.

  19. (TBD) Introduction to Design Patterns, Chapter 6 in, Eric Braude, Software Design: From Programming to Architecture, Wiley, 2004.

  20. (TBD) [Siemens book] Frank Buschmann, Regine Meunier, Hans Rohnert, Peter Sommerlad, and Michael Stal. Pattern-Oriented Software Architecture: A System of Patterns, Wiley, 1996.

  21. (TBD) (“Gang of Four” (GoF) book) Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides. Design Patterns: Elements of Reusable Object-Oriented Software, Addison Wesley, 1995.

  22. (TBD) Mark Grand. Patterns in Java: A Catalog of Reusable Design Patterns Illustrated with UML, Volume 1, Wiley, 1998.

  23. (TBD) Binary Tree Visitor Scala Framework

    1. Background: H. C. Cunningham, Y. Liu, and C. Zhang. Using classic problems to teach Java framework design, Science of Computer Programming, Special Issue on Principles and Practice of Programming in Java (PPPJ 2004), Vol. 59, No. 1-2, pp. 147-169, January 2006. doi: 10.10.16/j.scico.2005.07.009.
      [manuscript]

    2. Additional pattern references

      • GoF, “Composite,” pages 163-174.
        Grand, “Composite,” pages 165-174.

      • GoF, “Visitor,” pages 331-344.
        Grand, “Visitor,” pages 385-395.

      Scala versions (2008, 2010)

    3. Straightforward translation of the non-generic Java program to Scala

    4. Generic implementation of BinTree framework in Scala.

  24. (TBD) Use the Digraph ADT module to build the Wizard’s Adventure game

    1. Wizard’s Adventure game, Version 1, adapted from Chapter 5, 6, and 17 of Conrad Barski’s Land of Lisp: Learn to Program in Lisp, One Game at a Time, No Starch Press, 2011.

    2. Wizard’s Adventure game, Version 2, that uses a higher order function to generate game actions and improved handling of the game state.

  25. (TBD) Examine the Dice of Doom game.

    1. Background: Conrad Barski. Land of Lisp: Learn to Program in Lisp, One Game at a Time, No Starch Press, 2011.

    2. Dice of Doom, Version 1a, is a basic eagerly evaluated version (similar to that developed on pages 303-325 of Land of Lisp). This version supports either two human players or a human player and a simple, minimax search-based “AI” (artificial intelligence) opponent.

    3. Dice of Doom, Version 1b, is an eager version above with an attempt at memoization of functions neighbors and game_tree using the Elixir Agent modules.

    4. Dice of Doom, Version 2a, is a lazy version using Elixir Stream data structures (but without the memoization optimizations). This is based on version 1a above plus the discussion from pages 384-389 in chapter 18 of Land of Lisp. This version implements a limited depth minimax search, but it does not implement the artificial intelligence heuristics given in the last part of chapter 18.

  26. (TBD) Arithmetic expression tree program skeletons

    1. Background: These are expanded from the example in Notes on Scala for Java Programmers.

      Lua versions (2013-16)

    2. Lua recursive function versions (2013, 2014)

    3. Lua object-oriented versions (2013, 2016)

    4. Lua LPEG parsers (2013)

      Scala versions (2008-16)

    5. Scala recursive function version using case classes

    6. Scala traditional object-oriented version

  27. (TBD) Study the Movable and Named Objects case study (in Lua but based on a Haskell case study by Thompson)

    1. Purpose: The Named and Movable Objects case study explores use of inheritance hierarchies and multiple inheritance in Lua. I also extracted a “class support module” from the initial version of this code; this module was used in later case studies (e.g., Lair Configuration DSL).

      The “makeClass” function dynamically creates a “class” that has zero or more superclasses. It creates the class prototype object with an appropriate constructor/initialization function, appropriate default definitions of instance methods, and the needed settings of metaclasses and the __index metamethod to support the inheritance hierarchy.

    2. Background reading on object-oriented programming languages: Object-oriented subsection of the Fundamental Concepts of Programming Languages notes

    3. Background reading on case study: Section 14.6 of Simon Thompson. Haskell: The Craft of Functional Programming, Third Edition, Addison Wesley, 2011

      Note: We should readdress the design and implementation of this case study and the class support module. The latter may be too complex for our purposes in this course.

    4. First Lua version (movable.lua)

    5. Modularized Lua version with improved class support:

    6. Other older versions:

  28. (TBD) Examine the complex number arithmetic modules in Lua

    Modules are repeated in each package in which they are used

    1. Background reading: Structure and Interpretation of Computer Programs, Second Edition, MIT Press, 1996, Section 2.4

    SICP video lectures, Hal Abelson

    1. Rectangular coordinates modules:
      [arithmetic] [rectangular representation] [utilities] [test driver]

    2. Polar coordinates modules:  
      [arithmetic] [polar representation] [utilities] [test driver]

    3. Tagged data modules:   [arithmetic] [data tagging] [utilities] [test driver]

    4. Data-directed programming modules:  
      [arithmetic] [rectangular representation] [polar representation] [data tagging] [utilities] [test driver]

    5. Object-oriented modules:
      [arithmetic] [utilities] [test driver]

  29. (TBD) Kamin Interpreters in Lua Toolset (KILT)

    1. Kamin-Budd Interpreters

    2. 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)]

    3. 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)

    4. 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]

    5. 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]

  30. (TBD) Lua list module case study (Cell List)

    Purpose: This Lua case study illustrates (i) functional programming principles, (ii) design and implementation methods for abstract data types and information hiding modules, and, (iii) Lua programming techniques (linked lists, stateless iterators, closures, metatables, etc.)

    Background reading on Lua: Chapter 11 on data structures (pages 107-116) and Chapter 15 on modules (pages 151-161) of Programming in Lua (PiL), Third Edition

    Caveats: (1) These modules (from 2013-14) internally layer the operations into primitive and non-primitive operations, but they do not separate the primitive operations into its own module. That can be done similarly to the Rational Arithmetic case study. (2) In the future, I plan to construct a more efficient implementation that uses array-style tables. The table-based versions likely also need to use weak tables to avoid memory leaks.

    1. Cell-based list module:
      [module source] [test driver]

    2. Closure-and-table-based list module variant:
      [module source] [test driver]

    3. Function-based cell list module variant:
      [module source] [test driver]

    4. Lazy list module variant using C preprocessor (cpp -P):
      [module source] [source after cpp]
      [test driver] [driver after cpp] [sh script]

    5. Lazy list module variant using Lua Macro 2.5:
      [macro definitions] [module macro source] [source after luam -o]
      [macro test driver] [driver after luam -o] [sh script]

  31. (TBD) Examine functions adapted from SICP

    1. Background reading: Chapter 1 of the classic textbook 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] [SICP ebook site

    2. First-order functions in Scala

    3. Higher-order functions in Scala

    4. Lua versions

    5. Also various Haskell, Elixir, Elm, and Scheme versions

Unprocessed Old Materials

  1. Notes on Recursion Concepts and Terminology

  2. Notes on Functional Program Evaluation Concepts

  3. Jim Weirich. “Rake Tutorial,” “Rake User Guide,” and “Rake by Example,” 2005.
    (Basic ideas discussed.) [Ruby Rake web site]

  4. Jim Freeze. Creating DSLs with Ruby, Artima Developer, http://www.artima.com/rubycs/articles/ruby\_as\_dsl.html, March 2006.
    [Artima website] [[local printer-friendly copy](http://www.cs.olemiss.edu/~hcc/engr692ruby/notes/ruby\_as\_dslP.html)]

  5. Jamis Buck. Writing Domain Specific Languages, the { buckblogs :here }, 20 April 2006.
    [blog entry]