% CSci 658-01: Software Language Engineering \
  Spring 2018 Lecture Notes
% **H. Conrad Cunningham** 
% **12 February 2018 (after class)**

Copyright (C) 2018, 
[H. Conrad Cunningham ](<http://www.cs.olemiss.edu/~hcc>)

Professor of 
[Computer and Information Science ](<https://www.cs.olemiss.edu>) \
[University of Mississippi ](<http://www.olemiss.edu>) \
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**](<#current\_lecture>)


## Schedule, Notes, and Examples

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

#.  **(24, 26 Jan) Discuss "Little Languages" paper** and related issues

    Jon Bentley. [Programming Pearls: Little Languages
	](<localcopy/BentleyLittleLanguages.pdf>),
	*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)

   	a.  Brian W. Kernighan.
		[PIC \-- A Graphics Language for Typesetting, Revised User Manual
		](<http://doc.cat-v.org/unix/v8/picmemo.pdf>),
		Computing Science Technical Report No. 116,
		Bell Laboratories, December 1984.
		\[[local](<localcopy/picmemo.pdf>)\]
    #.  Eric S. Raymond.
	    [Making Pictures with GNU PIC
		](<http://floppsie.comp.glam.ac.uk/Glamorgan/gaius/web/pic.html>),
		August 1995.
    #.  Philipp K. Janert.
	    [In Praise of Pic
		](<http://www.onlamp.com/pub/a/onlamp/2007/06/21/in-praise-of-pic.html>),
		*ONLamp.com*, O\'Reilly Media, June 2007,
		Retrieved 24 January, 2018.
    #.  W. Richard Stevens.
		[Examples of `pic` Macros ](<localcopy/pic\_examples.pdf>),
		Retrieved from <http://www.kohala.com/start/>
		(troff resources, pic), 24 January 2018.
		\[[`pic` source](<localcopy/pic\_examples.txt>)\] 

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

	e.  [GraphViz \-- Graph Visualization Software 
		](<http://www.graphviz.org/>),
		Retrieved 26 January 2018.

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

    f.  Jon L. Bentley, Lynn W. Jelinski, and Brian W. Kernighan.
	    [Chem -- A Program for Phototypesetting Chemical Structure
	    Diagrams ](<localcopy/chem.pdf>),
   		AT&T Bell Laboratories, Murray Hill, NJ 07974, U.S.A.
    #.  Stuart I. Feldman.
	    [Make -- A Program for Maintaining Computer Program 
		](<localcopy/make.pdf>), *Software: Practice and Experience*, 
		Vol. 9, no. 4 pp. 255-265, 1979.
    #.  Stephen C. Johnson. 
	    [Yacc: Yet Another Compiler-Compiler ](<localcopy/yacc.pdf>), 
		Vol. 32. Murray Hill, NJ: Bell Laboratories, 1975.
    #.  Michael E. Lesk and Eric Schmidt.
	    [Lex: A Lexical Analyzer Generator ](<localcopy/lex.pdf>),
		Bell Laboratories Murray Hill, NJ, 1975.
    #.  [Learn X in Y Minutes, Where X = make (GNU) 
        ](<https://learnxinyminutes.com/docs/make/>) 


#.  **(26, 29 Jan) Discuss "No Silver Bullet" paper** and related issues

    Frederick P. Brooks. 
	[No Silver Bullet: Essence and Accident in Software Engineering 
	](<localcopy/NoSilverBullet.pdf>), 
	*IEEE Computer*, Vol. 20, No. 4, 10-19, 1987. 


#.  **(29, 31 Jan) Discuss "Language-Oriented Programming" paper**

     M. P. Ward. [Language-Oriented Programming
	 ](<http://www.cse.dmu.ac.uk/~mward/martin/papers/middle-out-t.pdf>), 
     *Software--Concepts and Tools,* Vol. 15, No. 4, pp. 147-161, 1994.
	 \[[local](<localcopy/LanguageOrientedProgramming.pdf>)\]

    Other references from paper (not discussed)
	
    a.  Charles Antony Richard Hoare. 
	    [The Emperor's Old Clothes 
		](<localcopy/Hoare\_Turing\_Address.pdf>)
		(1980 Turing Award Address), 
		*Communications of the ACM*, Vol. 24, No. 2, 75-83, 1981.


    <a name="current_lecture"></a>

#.  **(31 Jan; 2, 5, 14 Feb) Discuss [Domain Specific Languages 
    ](<DomainSpecificLanguages.html>) notes** and related issues

    References used in notes (not discussed directly)
	
    a.  Martin Fowler. Using Domain-Specific Languages, Chapter 2,
	    *Domain-Specific Languages*, Addison Wesley, 2011.
    #.  Steve Freeman and Nat Pryce.
        [Evolving an Embedded Domain-Specific Language in Java
	    ](<http://www.jmock.org/oopsla2006.pdf>), 
    	In *Proceedings of the ACM SIGPLAN International Conference 
	    on Object-Oriented Programming, Systems, Languages, and 
	    Applications (OOPSLA)*, 12 pages, 2006.
	    \[[local](<localcopy/EvolvingEmbeddedDSLJava.pdf>)\]
    #.  Gabor Karsai, Holger Krahn, Claas Pinkernell, Bernhard Rumpe, 
        Martin Schindler and Steven Voelkel.
		[Design Guidelines for Domain Specific Languages 
		](<https://arxiv.org/pdf/1409.2378>), 
	    In *Proceedings of OOPSLA Workshop on Domain-Specific 
	    Modeling*, 2009. Also arXiv preprint arXiv:1409.2378, 2014. 
	    \[[local](<localcopy/Design\_Guidelines\_DSLs.pdf>)\]
    #.  M. Mernik, J. Heering, and A. M. Sloane. 
        [When and How to Develop Domain Specific Languages 
	    ](<https://pdfs.semanticscholar.org/bd06/01088d5f217dc136a898f577763df92891cb.pdf>), 
        *ACM Computing Surveys*, 37(4):316-344, December 2005. 
        \[[local](<localcopy/WhenDSL.pdf>)\]


#.  **(5, 14 Feb) Discuss Fowler's introductory DSL example**

    Martin Fowler. [An Introductory Example 
	](<http://www.informit.com/articles/article.aspx?p=1592379>), 
	Chapter 1, *Domain-Specific Languages*, Addison Wesley, 2011. 


#.  **Survey Design Patterns** (see dates on items)
	
    a.  **(5, 7 Feb)** [Introduction to Patterns ](<Patterns/Patterns.html>) 
		\[[HTML slides](<Patterns/Intro\_Patterns.html>)\]

    #.  **(7 Feb)** [Pipes and Filters Architectural Pattern 
	    ](<Patterns/Pipes.html>)
	    (Not fully covered, used mainly to illustrate approach to
	    pattern definition)
	    \[[Powerpoint](<Patterns/sle\_Pipes\_Filters\_Pattern.ppt>)\]

    #.  **(9, 12 Feb)** John Vlissides. Designing with Patterns, 
        In *Pattern Hatching: Design Patterns Applied*, 
	    Addison-Wesley, 1998. 
        \[[slides](<Patterns/sle\_Designing\_with\_Patterns.ppt>)\]
			
    #.  Additional references from instructor's notes (not directly
        disucssed in class)
	
        -   [Factory Method Design Pattern (Powerpoint) 
		     ](<Patterns/sle\_Factory\_Method\_Pattern.ppt>) 
        -   [Strategy Design Pattern (Powerpoint) 
		     ](<Patterns/sle\_Strategy\_Pattern.ppt>)
        -   [Template Method Design Pattern (Powerpoint) 
		     ](<Patterns/sle\_Template\_Method\_Pattern.ppt>)

    #.  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 ](<http://www.google.com/url?sa=t&source=web&ct=res&cd=9&ved=0CDMQFjAI&url=http%3A%2F%2Fciteseerx.ist.psu.edu%2Fviewdoc%2Fdownload%3Fdoi%3D10.1.1.131.4205%26rep%3Drep1%26type%3Dpdf&ei=pA7XS82YIYHMNN_HqPsF&usg=AFQjCNGBwu48uiRxFJO1pgCIi94jSdu4FA&sig2=Ut3P0nKWRUwqByT_CFsIZw>),
            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](<localcopy/Shaw\_Patterns\_Arch.pdf>)\]


#.  Reference material possibly useful at this point 
    (may discuss explicitly later if needed)

    a.  Python 3 

	    -   [Learn X in Y Minutes, Where X = Python3 
            ](<https://learnxinyminutes.com/docs/python3/>) \

    #.  Scala

	    -   [Learn X in Y Minutes, Where X = Scala 
		    ](<https://learnxinyminutes.com/docs/scala/>) 
        -   [Notes on Scala for Java Programmers 
		    ](<ScalaForJava/ScalaForJava.html>)
		-   Paul Chiusano and Runar Bjarnason.
		    *Functional Programming in Scala*, Manning, 2015.
			-   Notes on [Functional Data Structures (Chapter 3)
			    ](<FPS03/FunctionalDS.html>)
		    -   Notes on [Error Handling without Exceptions (Chapter 4) 
			    ](<FPS04/ErrorHandling.html>)
		    -   Notes on [Strictness and Laziness (Chapter 5) 
			    ](<FPS05/Laziness.html>)
        -   Martin Odersky. [*Scala by Example* 
		    ](<http://www.scala-lang.org/docu/files/ScalaByExample.pdf>),
		    EPFL, 2014. \[[local](<localcopy/ScalaByExample.pdf>)\]
        -   Martin Odersky, Lex Spoon, and Bill Venners.
		    [*Programming in Scala* 
			](<http://www.artima.com/pins1ed/>),
			First Edition, Artima, 2008.

    #.  Object-oriented software development 

	    -   [Object-Oriented Software Development 
		    ](<OOSoftDev.html>) 
        -   [Programming Paradigms ](<ProgrammingParadigms.html>) 
		    (especially sections on the [object-oriented 
			](<ProgrammingParadigms.html#object-oriented>) 
			and [prototype-based 
			](<ProgrammingParadigms.html#prototype-based>) 
			paradigms)
	    -   [Using CRC Cards (Class-Responsibility-Collaboration) 
		    ](<UsingCRC.html>) 
		-   Kent Beck and Ward Cunningham. 
		    [A Laboratory for Teaching Object-Oriented Thinking 
			](<http://c2.com/doc/oopsla89/paper.html>), 
		    In *Proceedings of the OOPSLA'89 Conference*, ACM, 1989. 
	    -   Paul Gestwicki. [CRC Card Analysis (YouTube) 
		    ](<https://www.youtube.com/watch?v=otKUer13HnA>), 
			Ball State University, February 2016.

    #.  [Free online programming language textbooks and tutorials 
        ](<Free\_Prog\_Lang\_Textbooks.html>)


    <a name="StateMachineDSL"></a> 

#.  **(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.
	
	a.  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
	        ](<http://www.informit.com/articles/article.aspx?p=1592379>))
		    It is an example running through several of the 57 chapters 
		    of the book.

		-   Martin Fowler's 
		    [List of DSL Patterns 
		    ](<http://martinfowler.com/dslCatalog/>) 
		    from *Domain Specific Languages*, Addison Wesley, 2011 
		
	    *Scala versions (2009)*
	
    #.  Scala State Machine Semantic Model (Ch. 1, 3, 11)
	
	    -   [StateMachine.scala
	        ](<StateMachineDSL/Scala/StateMachine.scala>)
		-   [StateMachineTest.scala
	        ](<StateMachineDSL/Scala/StateMachineTest.scala>)
		-   [CommandChannel.scala (mock)
		    ](<StateMachineDSL/Scala/CommandChannel.scala>)
		-   [StateMachineDirect.sh test script 
		    ](<StateMachineDSL/Scala/StateMachineDirect.sh>) 

    #.  Scala XML-based External DSL (Ch. 1, 3, 5)
	
	    -   [StateMachineXMLTest .scala
            ](<StateMachineDSL/Scala/StateMachineXMLTest.scala>)
		-   [IncrementalStateMachineBuilder.scala 
		    ](<StateMachineDSL/Scala/IncrementalStateMachineBuilder.scala>)
		-   [input file SecretPanel.xml
		    ](<StateMachineDSL/Scala/SecretPanel.xml>)
		-   [StateMachineXML.sh test script 
		    ](<StateMachineDSL/Scala/StateMachineXML.sh>) 

    #.  Scala Custom External DSL with a Delimiter-Directed parser
	    (Ch. 1, 3, 5, 17)
		
		-   [DelimiterDSLTest.scala 
		    ](<StateMachineDSL/Scala/DelimiterDSLTest.scala>)
		-   [IncrementalStateMachineBuilder.scala 
		    ](<StateMachineDSL/Scala/IncrementalStateMachineBuilder.scala>)
		-   [input file CustomExternalStateMachineDSL.dsl 
		    ](<StateMachineDSL/Scala/CustomExternalStateMachineDSL.dsl>)	
		-   [DelimiterDSL.sh test script 
	        ](<StateMachineDSL/Scala/DelimiterDSL.sh>) 

    #.  Scala Custom External DSL with hand-coded Ad Hoc
	    Recursive-Descent parser (Ch. 1, 3, 5, 21)
		
		-   [RecursiveDescent.scala
	        ](<StateMachine/Scala/RecursiveDescemt.sh>) 
		-   [IncrementalStateMachineBuilder.scala
		    ](<StateMachineDSL/Scala/IncrementalStateMachineBuilder.scala>)
		-   [input file CustomExternalStateMachineDSL2.dsl
		    ](<StateMachineDSL/Scala/CustomExternalStateMachineDSL2.dsl>)
		-   [RecursiveDescent.sh test script 
	        ](<StateMachineDSL/Scala/RecursiveDescent.sh>) 


    #.  Scala Custom External DSL (using Scala parser combinator library)
	    with embedded state machine builder (Ch. 1, 3, 5, 22)
		
		-   [CombinatorParserBuilderTest.scala
	        ](<StateMachineDSL/Scala/CombinatorParserBuilderTest.scala>)
		-   [IncrementalStateMachineBuilder.scala
	        ](<StateMachineDSL/Scala/IncrementalStateMachineBuilder.scala>)
		-   [input file CustomExternalStateMachineDSL2.dsl
            ](<StateMachineDSL/Scala/CustomExternalStateMachineDSL2.dsl>)
		-   [CombinatorParserBuilder.sh test script 
	        ](<StateMachineDSL/Scala/CombinatorParserBuilder.sh>) 

    #.  Scala Custom External DSL (using Scala parser combinator library)
	    with full AST construction  (Ch. 1, 3, 5, 22)
		
		-   [CombinatorParserASTTest.scala
            ](<StateMachineDSL/Scala/CombinatorParserASTTest.scala>)
		-   [input file CustomExternalStateMachineDSL2.dsl 
		    ](<StateMachineDSL/Scala/CustomExternalStateMachineDSL2.dsl>)
		-   [CombinatorParserAST.sh test script 
	        ](<StateMachineDSL/Scala/CombinatorParserAST.sh>) 

    #.  Scala Static C Code Generator with Model-Aware target platform
	    library (Ch. 1, 3, 5, 8, 52, 55)
		
		-   [StaticC\_GeneratorTest.scala 
            ](<StateMachineDSL/Scala/StaticC\_GeneratorTest.scala>)
		-   [generated C output file output.c
            ](<StateMachineDSL/Scala/output.c>)
		-   [StaticC\_Generator.sh test script 
	        ](<StateMachineDSL/Scala/StaticC\_Generator.sh>)
		-   Note: The needed framework code needed to run the
            generated C program is not yet available in this form.  It
            needs to be reconstructed from Fowler's book.


    <a name="CompConfigDSL"></a>

#.  **(5, 14 Feb) Discuss Fowler's Computer Configuration
    Internal DSLs** (Ch. 4, 35, 36, 38)
	
	a.  Background: Martin Fowler. *Domain Specific Languages*,
        (Addison Wesley, 2011).

	    *Scala versions (2009)*
		
    #.  [Scala semantic model (shared)
		](<CompConfigDSL/Scala/Computer.scala>)

    #.  [Scala internal DSL using Method Chaining
	    ](<CompConfigDSL/Scala/CompConfigChaining.scala>)

    #.  [Scala internal DSL using Nested Closures and Object Scoping 
	    ](<CompConfigDSL/Scala/CompConfigClosure.scala>)

	#.  [CompConfig.sh test script 
	    ](<CompConfigDSL/Scala/CompConfig.sh>) 


    <a name="EmailMessageDSL"></a>

#.  (TBD) Discuss Fowler's Email Message Building Internal DSL 
    (Ch. 35)
	
	a.  Background: Martin Fowler. *Domain Specific Languages*,
        (Addison Wesley, 2011).

        *Scala versions (2009)*

    #.  [Scala internal DSL using Method Chaining and Progressive
	    Interfaces 
		](<EmailDSL/Scala/EmailProgressive.scala>)

	#.  [EmailProgressive.sh test script 
	    ](<EmailDSL/Scala/EmailProgressive.sh>) 


#.  **(assigned, not discussed yet, TBD) Discuss Coplien's SCV paper**

    James Coplien, Daniel Hoffman, and David Weiss. 
    [Commonality and Variability in Software Engineering 
	](<localcopy/CoplienCommonalityVariability.pdf>),
	*IEEE Software*, Vol. 15, No. 6, November 1998.


## Materials under Phase 2 Reconstruction

101. (TBD) [Domain Modeling slides ](<slides/DomainModeling.ppt>), 
     for course registration system example.


#.  (TBD) Mark Ardis, Nigel Daley, Daniel Hoffman, Harvey Siy, 
    and David Weiss. [Software Product Lines: A Case Study
	](<https://pdfs.semanticscholar.org/75bf/823305d898014d50ec4b47ed1d6cf42a17bf.pdf>),
	*Software Practice and Experience*, Vol. 30, No. 7, 
	pp. 825-847, 2000.


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


#.  (TBD) Ralph E. Johnson and Brian Foote. 
    [Designing Reusable Classes
	](<http://www.laputan.org/drc/drc.html>), 
    *Journal of Object-Oriented Programming*, 
	Vol. 1, No. 2, pages 22-35, June/July 1988. 


    <a name="SurveyDSL"></a>

#.  (TBD) Develop a Survey DSL
    
	a.  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.
 
		-   [manuscript   ](<localcopy/surveyLangFinal.pdf>)
	    -   [presentation ](<SurveyDSL/Ruby/surveyLanguage4.ppt>)

    #.  Ruby source code (2006, 2008)
	
	    -   [Ruby source code SurveyLanguage.rb 
		    ](<SurveyDSL/Ruby/SurveyLanguage\_rb.txt>)
	    -   [test DSL input file ](<SurveyDSL/Ruby/survey\_rb.txt>)
        -   [test DSL input file with errors 
		    ](<SurveyDSL/Ruby/surveyErrors\_rb.txt>)


    <a name="lua_slides"></a>

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

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

    #.  Background: The slides below are adapted, in part, from
        [*Programming in Lua, Slides for Course*
		](<http://www.dcc.ufrj.br/~fabiom/lua/>)
        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.

    #.  [Introduction to Lua ](<LuaIntro/01IntroLua.html>) 
	    slides based, in part, on Mascarenhas slide sets 0-5

    #.  [Advanced Lua Functions ](<LuaIntro/02IntroLua.html>) slides 
        based, in part, on Mascarenhas slide set 6 
	
    #.  [Modules in Lua ](<LuaIntro/03IntroLua.html>) slides 
        based, in part, on Mascarenhas slide set 9 
  
    #.  [Lua Metatables ](<LuaIntro/04IntroLua.html>)
        slides based, in part, on Mascarenhas slide set 10

    #.  [Lua Objects ](<LuaIntro/05IntroLua.html>) slides 
        based, in part, on Mascarenhas slide set 11


    <a name="LairDSL"></a> 

#.  (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. 
    a. Background:
	
	    -   Case study: Martin Fowler's 
		    [One Lair and Twenty Ruby DSLs 
		    ](<http://media.pragprog.com/titles/twa/martin\_fowler.pdf>), 
            Chapter 3, 
            [*The ThoughtWorks Anthology: Essays on Software Technology 
			and Innovation* 
			](<http://pragprog.com/book/twa/thoughtworks-anthology>), 
            The Pragmatic Bookshelf, 2008 
			[\[local chapter](<LairDSL/FowlerOneLairTwentyDSLs.pdf>)\]
        -   Patterns (repeated from above): Martin Fowler's 
		    [List of DSL Patterns 
		    ](<http://martinfowler.com/dslCatalog/>) 
		    from *Domain Specific Languages*, Addison Wesley, 2011 
        -   Source code: 
		    \[[entire book 
			](<https://pragprog.com/titles/twa/source\_code>)\] 
			\[[Fowler's Ruby DSLs ](<LairDSL/FowlerRubyCode>)\]

        *Lua versions (2013)*

    #.  Lua shared modules
  
        -   [Class support module (for implementing classes in Lua)
	        ](<LairDSL/Lua/class\_support.lua>)
        -   [Semantic model ](<LairDSL/Lua/model.lua>)
        -   [Test driver for semantic model (rules00.lus)
		    ](<LairDSL/Lua/rules00.lua>)


    #.  Lua internal DSLs
  
        -   Using Global Function Sequence pattern \
            [builder module (builder08.lua)
	        ](<LairDSL/Lua/builder08.lua>) -- 
            [dsl script (rules08.lua) 
			](<LairDSL/Lua/rules08.lua) --
            [test driver (test08.lua) 
			](<LairDSL/Lua/test08.lua)

        -   Using Class Method Function Sequence and Method Chaining
            patterns \
            [builder module (builder11.lua) 
			](<LairDSL/Lua/builder11.lua>) --
            [dsl script (rules11.lua) 
			](<LairDSL/Lua/test11.lua>)
	   
        -   Using Expression Builder and Method Chaining patterns \
            [builder module (builder14.lua)
	        ](<LairDSL/Lua/builder14.lua>) -- 
		    [dsl script (rules14.lua)
		    ](<LairDSL/Lua/rules14.lua>) --
            [test driver (test14.lua)
		    ](<LairDSL/Lua/test14.lua>)

        -   Using Nested Closures pattern \
            [builder module (builder03.lua)
	        ](<LairDSL/Lua/builder03.lua>) --
            [dsl script (rules03.lua) 
			](<LairDSL/Lua/rules03.lua>) --
		    [test driver (test03.lua) 
			](<LairDSL/Lua/test03.lua>)

        -   Using Expression Builder, Object Scoping, and Method
            Chaining patterns \
            [builder module (builder17.lua) 
			](<LairDSL/Lua/builder17.lua>) --
            [dsl script (rules17.lua) 
			](<LairDSL/Lua/rules17.lua>) -- 
			[test driver (test17.lua) 
			](<LairDSL/Lua/test17.lua>)

        -   Using Literal Collection pattern \
            [builder module (builder22.lua) 
		    ](<LairDSL/Lua/builder22.lua>) -- 
            [dsl script (rules22.lua) 
		    ](<LairDSL/Lua/rules22.lua>) --
		    [test driver (test22.lua) 
            ](<LairDSL/Lua/test22.lua>)

    #.  Lua external DSLs

        -   Using LPEG Parser/Builder (no corresponding example in
            Fowler paper)\
            [builder module (builderLPEG1.lua) 
			](<LairDSL/Lua/builderLPEG1.lua>) --
            [dsl script (rulesLPEG1.dsl) 
			](<LairDSL/Lua/rulesLPEG1.dsl>) --
            [test driver (testLPEG1.lua) 
			](<LairDSL/Lua/testLPEG1.lua>)


    <a name="ReaderDSL"></a>

#.  (TBD) Discuss Fowler's DSL Reader framework

    a.  Background: 
	    
		-   Martin Fowler. 
		    [Language Workbenches: The Killer-App for Domain Specific Languages? 
		    ](<http://www.martinfowler.com/articles/languageWorkbench.html>)
            June 2005.
        -   Martin Fowler. [Generating Code for DSLs, 
            ](<http://www.martinfowler.com/articles/codeGenDsl.html>), 
	        June 2005.
		
		*Ruby DSLs (2006)*

    #.  Ruby shared modules
	
        -   [DSL Reader Framework module 
            ](<ReaderDSL/Ruby/ReaderFramework.rb>)
        -   [DSL Reader Utilities mix-in module
	        ](<ReaderDSL/Ruby/ReaderUtilities.rb>)
        -   [Data input file ](<ReaderDSL/Ruby/fowlerdata.txt>)
        -   [Text DSL description ](<ReaderDSL/Ruby/dslinput.txt>)
        -   [XML DSL description  ](<ReaderDSL/Ruby/dslinput.rb>)

    #.  Ruby direct configuration and testing of Reader
        
		-   [BuilderDirect.rb ](<ReaderDSL/Ruby/BuilderDirect.rb>)

    #.  Ruby single-pass external text DSL
	
	    -   [TextSinglePass.rb ](<ReaderDSL/Ruby/TextSinglePass.rb>)

    #.  Ruby two-pass external XML DSL
	
	    -   [TwoPass.rb ](<ReaderDSL/Ruby/TwoPass.rb>)
		-   [class BuilderExternal source code generated by TwoPass.rb
		    ](<ReaderDSL/Ruby/GeneratedBuilderExternal.rb>)

    #.  Ruby internal DSL
	
	    - [RubyDSL.rb ](<ReaderDSL/Ruby/RubyDSL.rb>)


    <a name="SandwichDSL"></a>
	
#.  (TBD) Sandwich DSL Case Study 

    a.  [Haskell version (2017)](<SandwichDSL/Haskell/SandwichDSL.html>)
	
    b.  [Scala version (2016)  ](<SandwichDSL/Scala/SandwichDSL.html>) 

    c.  Lua version (simpler, 2013)
	
        -   [Semantic model module
            ](<SandwichDSL/Lua/sandwich\_model.lua>)
        -   [DSL builder module using function sequence pattern
            ](<SandwichDSL/Lua/sandwich\_builder.lua>)
        -   [Test driver ](<SandwichDSL/Lua/test\_sandwichDSL.lua>)


#.  (TBD) Abstract data types and modular design 

    a.  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](<localcopy/Cunningham\_Table\_Abstraction.pdf>)\]
            \[[slides](<slides/TableFramework8.ppt>)\]

    #.  [Modular Design ](<ModularDesign.html>) 
  
    #.  [Data Abstraction ](<DataAbstraction.html>):
	    \[[slides ](<slides/Data\_Abstraction\_rev2.ppt>)]

    #.  (OO reference materia, repeated from abovel)
        [Object-Oriented Software Development ](<OOSoftDev.html>) 

    #.  (Programming paradigms reference material, repeated from above) 
        [Programming Paradigms ](<ProgrammingParadigms.html>) 

    #.  William R. Cook. [On understanding data abstraction revisited
        ](<http://www.cs.utexas.edu/~wcook/Drafts/2009/essay.pdf>). 
        In *Proceedings of OOPSLA*, October 2009. \
        \[[local](<localcopy/Understanding_Data_Abstraction_Revisited.pdf>)\]

    #.  K. H. Britton, R. A. Parker, and D. L. Parnas.
	    [A procedure for designing abstract interfaces for device interface modules
	    ](<localcopy/Parnas\_Abstract\_Interfaces.pdf>),
	    In *Proceedings of the 5th International Conference on Software
        Engineering*, pp. 195-204, March 1981.
	
    #.  D. L. Parnas. 
	    [On the criteria to be used in decomposing systems into modules 
	    ](<localcopy/Parnas\_Criteria\_Decomposing.pdf>),
	    *Communications of the ACM*, Vol. 15, No. 12, pp. 1053-1058, 1972.

    #.  D. L. Parnas. 
	    [On the design and development of program families 
		](<localcopy/Parnas\_Families.pdf>),
		*IEEE Transactions on Software Engineering*, 
		Vol. SE-2, No. 1, pp. 1-9, March 1976.

    #.  D. L. Parnas. 
	    [Designing software for ease of extension and contraction 
		](<localcopy/Parnas\_Extension\_Contraction.pdf>), 
		*IEEE Transactions on Software Engineering*, 
		Vol. SE-5, No. 1, pp. 128-138, March 1979.

    #.  D. L. Parnas, P. C. Clements, and D. M. Weiss. 
	    [The modular structure of complex systems 
		](<localcopy/Parnas\_Modular\_Structure.pdf>),
		*IEEE Transactions on Software Engineering*, 
		Vol. SE-11, No. 3, pp. 259-266, March 1985.


## Materials under Phase 1 Reconstruction

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

     a.  [Cookie Jar ADT Problem Description 
         ](<CookieJar/Scala/CookieJar\_problem.html>) 
  
     #.  [Specification concepts and notation 
         ](<CandyBowl/Lua/candybowl\_semantics.html#specifying-semantics>) 
         -- from Candy Bowl ADT description
        
     #.  Immutable CookieJar ADT Implementation in Scala (`ICookieJar`) 
         -- uses method chaining functional style with immutable objects

         -   [ADT specification as Scala trait 
             ](<CookieJar/Scala/immutable/ICookieJar.scala>) 
         -   [List version 
             ](<CookieJar/Scala/immutable/ICookieJarList.scala>) 
         -   [HashMap version 
             ](<CookieJar/Scala/immutable/ICookieJarMap.scala>) 
         -   [List of tuples version 
             ](<CookieJar/Scala/immutable/ICookieJarTupleList.scala>) 
         -   [Blackbox test script 
             ](<CookieJar/Scala/immutable/ICookieJarTest.scala>) 

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

         -   [ADT specification as Scala trait 
             ](<CookieJar/Scala/mutable/CookieJar.scala>)
         -   [List version 
              [ArrayBuffer version 
             ](<CookieJar/Scala/mutable/CookieJarArrayBuffer.scala>) 
         -   [HashMap version 
             ](<CookieJar/Scala/mutable/CookieJarMap.scala>) 
         -   [List of tuples version 
             ](<CookieJar/Scala/mutable/CookieJarTupleList.scala>) 
         -   [Array version 
             ](<CookieJar/Scala/mutable/CookieJarArray.scala>) 
         -   [Blackbox test script 
             ](<CookieJar/Scala/mutable/CookieJarTest.scala>) 

     #.  [Similar specification and Ruby program 
         ](<CookieJar/Ruby/CookieJarRuby.txt>) 


#.  (TBD) Examine Carrie's Candy Bowl ADT (abstract data type) case study

    a.  Lua 

        -   [ADT Semantics  ](<CandyBowl/Lua/candybowl_semantics.html>) 
        -   [Hashed version ](<CandyBowl/Lua/candybowl_hash.lua>) 
        -   [Unsorted List version ](<CandyBowl/Lua/candybowl_list.lua>) 
        -   [Test driver    ](<CandyBowl/Lua/test_candybowl.lua>) 

    #.  Scala

        -   [CandyBowl trait ](<CandyBowl/Scala/CandyBowl.scala>)
        -   [CandyBowlList class ](<CandyBowl/Scala/CandyBowlList.scala>)


#.  (TBD) Examine the Labeled Digraph case study

    a.  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.
                
    #.  Haskell solutions (2015)
        
        -   [Labelled Digraph Abstract Data Type 
		    ](<Digraph/Haskell/DigraphADT.html>) 
        -   List representation for vertices and edges:
            \[[module ](<Digraph/Haskell/DigraphADT\_List.hs>)\]
            \[[test module ](<Digraph/Haskell/DigraphADT\_TestList.hs>)\]
        -   Map representation for graph:
            \[[module ](<Digraph/Haskell/DigraphADT\_Map.hs>)\]
            \[[test module ](<Digraph/Haskell/DigraphADT\_TestMap.hs>)\]
  
    #.  Elixir solutions (2015)

        -   Tuple and list representation for graph:
            \[[module ](<Digraph/Elixir/Digraph\_List.ex>)\]
            \[[test module ](<Digraph/Elixir/Digraph\_Test.exs>)\]

    #.  Scala solutions (2016)
       
        -   Abstract data type specification and Scala trait (interface):
            \[[ADT interface ](<Digraph/Scala/Digraph.scala>)\]
        -   List representation for vertices and edges:
            \[[class source ](<Digraph/Scala/DigraphList.scala>)\]
            \[[test source ](<Digraph/Scala/Test_DigraphList.scala>)\]
        -   Map (HashMap) representation for graph:
            \[[class source ](<Digraph/Scala/DigraphMap.scala>)\]
            \[[test source ](<Digraph/Scala/Test_DigraphMap.scala>)\]

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

        -   [Wizard's Adventure game, Version 1, 
		    ](<Wizard/Elixir/wizards_game.ex>)
            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.

        -   [Wizard's Adventure game, Version 2, 
		    ](<Wizard/Elixir/wizards_game2a.ex>)
            that uses a higher order function to generate game actions 
			and improved handling of the game state.


#.  (TBD) Parsing Expression Grammars

    a.  Wikipedia entry on [Parsing Expression Grammar 
	    ](<http://en.wikipedia.org/wiki/Parsing\_expression\_grammar>)
		
    #.  Bryan Ford. Parsing Expression Grammars: A recognition-based
	    syntactic foundation. \
		\[[slides](<http://www.brynosaurus.com/pub/lang/peg-slides.pdf>)\]


#.  (TBD) Doug Rosenberg with Kendall Scott. "Domain Modeling," 
    Chapter 2 in *Use Case Driven Object Modeling with UML*, 
	Addison Wesley 1999.


#.  (TBD)  Doug Rosenberg with Kendall Scott. "Use Case Modeling," 
    Chapter 3 in *Use Case Driven Object Modeling with UML*, 
	Addison Wesley 1999.


#.  (TBD)  Reference: Alistair Cockburn. "Introduction," 
    Chapter 1 in *Writing Effective Use Cases*, 
	Addison-Wesley, 2001.


#.  (TBD) Understanding Inheritance, based on Timothy Budd's 
    *Understanding Object-Oriented Programming with Java*, 
	Chapter 8: \
    \[[slides](<sd_08\_Inheritance.ppt>)\]


#.  (TBD) Simple, silly Employee hierarchy example

    a.  [Scala (2008, 2010) ](<Employee/Scala/EmployeeTest.scala>)
	
	#.  [Ruby (2006)](<Employee/Ruby/employee.rb>)


#.  (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. 

    a.  Background on Peano arithmetic
        
		-   [Peano Axioms ](<http://en.wikipedia.org/wiki/Peano_axioms>),
            Wikipedia article
        -   [Peano's Axioms
		    ](<http://mathworld.wolfram.com/PeanosAxioms.html>),
			Wolfram MathWorld article
			
    #.  Background on software design patterns
	
	    - [Source Making ](<https://sourcemaking.com/design_patterns>) website

    #.  [Lua version (2013) ](<Nat/Lua/nats2.lua>)

    #.  Elixir version (2015)
	
		-   [Nat module  ](<Nat/Elixir/Nat.ex>)
        -   [test module ](<Nat/Elixir/Nat_Test.ex>)
        -   [test script ](<Nat/Elixir/Nat.exs>)

    #.  Scala versions (2012, 2016)

        -   [Functional object-oriented style with ordinary classes 
		    ](<Nat/Scala/TestNats.scala>)
        -   [Functional object-oriented style with case classes
		    ](<Nat/Scala/TestCaseObjNats.scala>)
        -   [Functional module style with case classes
            ](<Nat/Scala/TestCaseExtNats.scala>)

    #.  [Ruby version (2006) ](<Nat/Ruby/Nat.txt>)

    #.  Java version (2004, 2016), simpler, no generics
	
	    -   [abstract base class Nat ](<Nat/Java/Nat.txt>) 
	    -   [subclass Zero ](<Nat/Java/Zero.txt>) 
	    -   [subclass Succ ](<Nat/Java/Succ.txt>) 
	    -   [subclass Err  ](<Nat/Java/Err.txt>) 
	    -   [TestNat main program ](<Nat/Java/TestNat.txt>) 


#.  (TBD) Software Reuse, based on Timothy Budd's 
    *Understanding Object-Oriented Programming with Java*, 
	Chapter 10: \
    \][slides](<sd\_10\_Software\_Reuse.ppt>)\]\

    -   [Scala translation of Frog dynamic composition example 
        ](<Frog/Scala/FrogTest.scala>)


#.  (TBD) Replacement and Refinement, loosely based on Timothy Budd's 
    *An Introduction to Object-Oriented Programming*, Third Edition,
    Section 16.2: \
	\[[slides](<slides/sd\_Replace\_Refine.ppt>)\]


#.  (TBD) Implications of Inheritance, based on Timothy Budd's 
    *Understanding Object-Oriented Programming with Java*, 
	Chapter 11: \
    \[[slides](<slides/sd\_11Implication\_Inheritance.ppt>)\]\


#.  (TBD) Multiple Inheritance, based on Timothy Budd's 
    *An Introduction to Object-Oriented Programming*, Third Edition, 
	Chapter 13: \
    \[[slides](<slides/sd\_11Multiple\_Inheritance.ppt>)\]\

    -   [Scala Modified Philosophical Frog example from Odersky et a
        \[[source](<PhilFrog/Scala/PhilFrog.scala>)\]

    -   Scala Modified Stackable traits example (IntQueue) from Odersky et al:
        \[[source](<Stackable/Scala/StackableTest.scala>)\] 


#.  (TBD) Polymorphism, based on Timothy Budd's 
    *Understanding Object-Oriented Programming with Java*, 
	Chapter 12: \
	\[[slides](<slides/sd\_12Polymorphism.ppt>)\]\


#.  (TBD) Second Look at Classes, loosely based on Timothy Budd's 
    *An Introduction to Object-Oriented Programming*, 
	Chapter 25 on Reflection and Introspection: \
	\[[slides](<slides/sd\_Second\_Look\_at\_Classes.ppt>)\]


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

    a.  Simple Sorting Framework in Scala

        -   [Low-level concrete Employee sorting
            ](<SortFramework/Scala/SortEmployee.scala>)
        -   [Insertion Sorting framework
		    ](<SortFramework/Scala/InsertionSorter.scala>)
        -   [Employee Sorting application of framework
            ](<SortFramework/Scala/EmployeeSorter.scala>)
        -   [Test code for Employee Sorting application of framework 
		    ](<SortFramework/Scala/TestEmployeeSorter.scala>)
		
    #.  Ice Cream Store discrete event simulation
	
        -   [Simulation framework 
		    ](<IceCreamStore/Scala/SimFramework.scala>)
        -   [Ice Cream Store application 
		    ](<IceCreamStore/Scala/IceCreamStoreApp.scala>)


#.  (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 
	](<http://www.cs.olemiss.edu/~hcc/papers/classicProblems.pdf>)\]

    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.

    -   [Template-based Divide-and-Conquer Framework (DivConqTemplate) 
	    ](<DivConq/Scala/DivConqTemplate.scala>)
    -   [Strategy-based Divide-and-Conquer Framework (DivConqStrategy) 
        ](<DivConq/Scala/DivConqStrategy.scala>)
    -   [Traits for Problem and Solution descriptions for both frameworks
        (DivConqProblemSolution)
        ](<DivConq/Scala/DivConqProblemSolution.scala>)
    -   [Application of Template-based framework to QuickSort
        (QuickSortTemplateApp) 
        ](<DivConq/Scala/QuickSortTemplateApp.scala>)
    -   [Application of Strategy-based framework to QuickSort
        (QuickSortStrategyApp)
		](<DivConq/Scala/QuickSortStrategyApp.scala>)
    -   [Descriptor for QuickSort state for both QuickSort
        applications (QuickSortDesc)
        ](<DivConq/Scala/QuickSortDesc.scala>)


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


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

#.  (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.

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

    -   Template Method Design Pattern:
        \[[slides](<slides/sd\_Template\_method\_pattern.ppt>)\]\
        Reference: Gof,   "Template Method," pp. 325-329.\
        Reference: Grand, "Template Method," pp. 377-384.

    -   Strategy Design Pattern:
        \[[slides](<slides/sd\_Strategy\_pattern.ppt>)\] \
        Reference: GoF,   "Strategy," pp. 315-323. \
        Reference: Grand, "Strategy," pp. 371-376.

    -   Factory Method Design Pattern:
        \[[slides](<slides/sd\_Factory\_method\_pattern.ppt>)\]\
        Reference: GoF, "Factory Method," pp. 107-116.\ 
		

#.  (TBD) Binary Tree Visitor Scala Framework


    a.  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
        ](<http://www.cs.olemiss.edu/~hcc/papers/classicProblems.pdf>)\]
		
    #.  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)*

    #.  Straightforward translation of the non-generic Java program to Scala
	
        -   [Top-level framework (BinTreeFramework) 
		    ](<BinTree/Scala/Nongeneric/BinTreeFramework.scala>)
		-   [Second-level Euler tour framework (EulerTourVisitor) 
            ](<BinTree/Scala/Nongeneric/EulerTourVisitor.scala>)
        -   [Second-level mapping visitor framework (MappingVisitor) 
		    ](<BinTree/Scala/Nongeneric/MappingVisitor.scala>)
		-   [Second-level breadth-first framework (BreadthFirstVisitor)
            ](<BinTree/Scala/Nongeneric/BreadthFirstVisitor.scala>)
		-   [Application of BinTree frameworks (BinTreeTest)
            ](<BinTree/Scala/Nongeneric/BinTreeTest.scala>)
		
    #.  Generic implementation of BinTree framework in Scala.

        -   [Top-level framework (BinTreeFramework) 
		    ](<BinTree/Scala/Generic/BinTreeFramework.scala>)
		-   [Second-level Euler tour framework (EulerTourVisitor)
            ](<BinTree/Scala/Generic/EulerTourVisitor.scala>)
		-   [Second-level breadth-first framework (BreadthFirstVisitor)
			](<BinTree/Scala/Generic/BreadthFirstVisitor.scala>)
        -   [Application of BinTree frameworks (BinTreeTest)
            ](<BinTree/Scala/Generic/BinTreeTest.scala>)


#.  (TBD) Use the Digraph ADT module to build the Wizard's Adventure game

    a.  [Wizard's Adventure game, Version 1, ](<Wizard/Elixir/wizards_game.ex>)
        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.
    
    b.  [Wizard's Adventure game, Version 2, ](<Wizard/Elixir/wizards_game2a.ex>)
        that uses a higher order function to generate game actions and
        improved handling of the game state.


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

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

    b.  [Dice of Doom, Version 1a ](<Dice\_of\_Doom/Elixir/dice_of_doom_v1a.ex>),
        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.

    c.  [Dice of Doom, Version 1b ](<Dice\_of\_Doom/Elixir/dice_of_doom_v1b.ex>),
        is an eager version above with an attempt at memoization of
        functions `neighbors` and `game_tree` using the Elixir `Agent`
        modules.
                
    d.  [Dice of Doom, Version 2a,
        ](<Dice\_of\_Doom/Elixir/dice_of_doom_v2a.ex>) 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.


#.  (TBD) Arithmetic expression tree program skeletons

    a.  Background: These are expanded from the example in 
	    [Notes on Scala for Java Programmers 
		](<ScalaForJava/ScalaForJava.html>). 

        *Lua versions (2013-16)*
		
    #.  Lua recursive function versions (2013, 2014)
  
        -   [Lua Recursive Functions with Record Representation
			](<Expression/Lua/exprRecFuncRecord.lua>)
        -   [Lua Recursive Functions with List Representation
		    ](<Expression/Lua/exprRecFuncList2.lua>)
        -   [Lua Evaluation Function Table with List Representation
		    ](<Expression/Lua/exprEvalTable2.lua>)
		
    #.  Lua object-oriented versions (2013, 2016)
  
        -   [Lua Prototype Object-Based 
		    ](<Expression/Lua/exprObjBased.lua>)
        -   [Lua Object-Oriented with Inheritance
		    ](<Expression/Lua/exprObjInherit.lua>)
	
    #.  Lua LPEG parsers (2013)

        -   [Parser with captures 
		    ](<ExprParser/Lua/exprParser.lua>) 
		-   [Parser with semantic actions 
		    ](<ExprParser/Lua/exprParserSemantic.lua>)

        *Scala versions (2008-16)*

    #.  [Scala recursive function version using case classes 
	    ](<Expression/Scala/ExprCase.scala>)
  		
    #.  [Scala traditional object-oriented version
        ](<Expression/Scala/ExprObj.scala>)


    <a name="movable"></a>

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

    a.  *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.

    #.  Background reading on object-oriented programming languages:
		[Object-oriented](<Fundamentals/01Fundamental450.html#object-oriented>)
        subsection of the [Fundamental Concepts of Programming Languages
		](<Fundamentals/01Fundamental450.html>) notes

    #.  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.

    #. [First Lua version](<Movable/Lua/movable.lua>)
       (movable.lua)

    #.  Modularized Lua version with improved class support:	
	    
	    -   [class support module](<Movable/Lua/class_support.lua>) 
	        (class_support.lua) 
        -   [module using class-support](<Movable/Lua/movable2.lua>)
            (movable2.lua)
        -   [test driver](<Movable/Lua/movable2Test.lua>) 
	        (movable2Test.lua)
  
    #.  Other older versions:
	
	    -   [Haskell source](<Movable/Scala/MovableNamedTypes.hs>)
        -   [Scala source (partial)](<Movable/Scala/Movable.scala>)



    <a name="complexNumberLua"></a> 

#.  (TBD) Examine the complex number arithmetic modules in Lua 
	
    Modules are repeated in each package in which they are used

    a.  *Background* reading:
	    [*Structure and Interpretation of Computer Programs* 
	    ](<http://mitpress.mit.edu/sicp/>), Second Edition, MIT Press, 1996,
        Section 2.4

    >   [SICP video lectures, Hal Abelson
        ](<https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-001-structure-and-interpretation-of-computer-programs-spring-2005/video-lectures/>)

    b.  Rectangular coordinates modules: \
        [[arithmetic]](<Complex/Lua/complexRectangular.lua>) 
        [[rectangular representation]](<Complex/Lua/complexRectangularRep.lua>)
        [[utilities]](<Complex/Lua/complexUtilities.lua>)
        [[test driver]](<Complex/Lua/testComplexRectangular.lua>)

    b.  Polar coordinates modules: \	
        [[arithmetic]](<Complex/Lua/complexPolar.lua>) 
        [[polar representation]](<Complex/Lua/complexPolarRep.lua>)
        [[utilities]](<Complex/Lua/complexUtilities.lua>)
        [[test driver]](<Complex/Lua/testComplexPolar.lua>)

    c.  Tagged data modules: \	
        [[arithmetic]](<Complex/Lua/complexTagged.lua>)
        [[data tagging]](<Complex/Lua/dataTagging.lua>)
        [[utilities]](<Complex/Lua/complexUtilities.lua>)
        [[test driver]](<Complex/Lua/testComplexTagged.lua>)

    d.  Data-directed programming modules: \	
        [[arithmetic]](<Complex/Lua/complexDataDirected.lua>)
        [[rectangular  representation]](<Complex/Lua/complexRectangularRep.lua>)
        [[polar representation]](<Complex/Lua/complexPolarRep.lua>)
        [[data tagging]](<Complex/Lua/dataTagging.lua>)
        [[utilities]](<Complex/Lua/complexUtilities.lua>)
        [[test driver]](<Complex/Lua/testComplexDataDirected.lua>)

    e.  Object-oriented modules: \
	    [[arithmetic]](<Complex/Lua/complexObjOriented.lua>)
        [[utilities]](<Complex/Lua/complexUtilities.lua>)
        [[test driver]](<Complex/Lua/testComplexObjOriented.lua>)


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

    a.  [Kamin-Budd Interpreters](<Kamin_Budd_interpreters/>)

    a.  Language/Interpreter-independent modules:\
        \[[REPL Module (repl.lua)](KILT/repl.lua)\]\
        \[[Environment Module
        (environment.lua)](KILT/environment.lua)\]\
        \[[Function Table Module (funtab.lua)](KILT/funtab.lua)\]\
        \[[Utilities Module (utilities.lua)](KILT/utilities.lua)\]\
        \[[Opcodes Factory Module (opcodes.lua)](KILT/opcodes.lua)\]\
        \[[Values Factory Module (values.lua)](KILT/values.lua)\]\
        \[[Parser Factory Module (parser.lua)](KILT/parser.lua)\]\
        \[[Evaluator Factory Module (evaluator.lua)](KILT/evaluator.lua)\]
	
    b.  Kamin Chapter 1 Core language interpreter:\
        \[[Core Interpreter (Core.lua)](KILT/Core.lua)\]\
        \[[Core Opcodes (opcodes\_core.lua)](KILT/opcodes\_core.lua)\]\
        \[[Core Values Module
        (values\_core.lua)](KILT/values\_core.lua)\]\
        \[[Core Parser Module
        (parser\_core.lua)](KILT/parser\_core.lua)\]\
        \[[Core Evaluator Module
        (evaluator\_core.lua)](KILT/evaluator\_core.lua)

    c.  Kamin Chapter 2 Lisp language interpreter:\
        \[[Lisp Interpreter (Lisp.lua)](KILT/Lisp.lua)\]\
        \[[Lisp Opcodes (opcodes\_lisp.lua)](KILT/opcodes\_lisp.lua)\]\
        \[[Lisp Values Module
        (values\_lisp.lua)](KILT/values\_lisp.lua)\]\
        \[[Lisp Parser Module
        (parser\_lisp.lua)](KILT/parser\_lisp.lua)\]\
        \[[Lisp Evaluator Module
        (evaluator\_lisp.lua)](KILT/evaluator\_lisp.lua)\
        \[[A few Lisp examples](KILT/LispExamplesKaminChap2.txt)\]

    d.  Kamin Chapter 4 Scheme language interpreter:\
        \[[Scheme Interpreter (Scheme.lua)](KILT/Scheme.lua)\]\
        \[[Scheme Opcodes
        (opcodes\_scheme.lua)](KILT/opcodes\_scheme.lua)\]\
        \[[Scheme Values Module
        (values\_scheme.lua)](KILT/values\_scheme.lua)\]\
        \[[Scheme Parser Module
        (parser\_scheme.lua)](KILT/parser\_scheme.lua)\]\
        \[[Scheme Evaluator Module (evaluator\_scheme.lua)](KILT/evaluator\_scheme.lua)\
        \[[A few Scheme examples](KILT/SchemeExamples.txt)\]


    <a name="cellList"></a>

#.  (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.

    a.  Cell-based list module:\
        [[module source]](<CellLists/Lua/cellList.lua>)
        [[test driver]](<CellLists/Lua/cellListTest.lua>)

    b.  Closure-and-table-based list module variant:\
        [[module source]](<CellLists/Lua/cellListClosure.lua>)
        [[test driver]](<CellLists/Lua/cellListClosureTest.lua>)

    c.  Function-based cell list module variant:\
        [[module source]](<CellLists/Lua/cellListFunct.lua>)
        [[test driver]](<CellLists/Lua/cellListFunctTest.lua>)

    d.  Lazy list module variant using C preprocessor (cpp -P):\
        [[module source]](<CellLists/Lua/lazyList1.lua>)
        [[source after cpp]](<CellLists/Lua/lazyList1X.lua>) \
        [[test driver]](<CellLists/Lua/lazyList1Test.lua>)
        [[driver after cpp]](<CellLists/Lua/lazyList1TestX.lua>)
        [[sh script]](<CellLists/Lua/lazyList1run.sh>)

    e.  Lazy list module variant using
        [Lua Macro 2.5](<https://github.com/stevedonovan/LuaMacro>):\
	    [[macro  definitions]](<CellLists/Lua/lazyListMacros.lua>)
        [[module macro source]](<CellLists/Lua/lazyList2.luam>)
        [[source after luam -o]](<CellLists/Lua/lazyList2.lua>) \
        [[macro test driver]](<CellLists/Lua/lazyList2Test.luam>)
        [[driver after luam -o]](<CellLists/Lua/lazyList2Test.lua>)
        [[sh script]](<CellLists/Lua/lazyList2run.sh>)


    <a name="SICPch1"></a>

#.  (TBD) Examine functions adapted from SICP 

    a.  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](<http://mitpress.mit.edu/sicp/>)\]
		\[[HTML](<http://mitpress.mit.edu/sicp/full-text/book/book.html>)\]
		\[[SICP ebook site](<http://sicpebook.wordpress.com/>)
		
    #.  First-order functions in Scala

        -   [Square root (Newton's Method) with all public functions 
		    ](<SICP\_examples/Scala/sqrt.scala>)
        -   [Square root (Newton's Method) with nested function definitions 
		    ](<SICP\_examples/Scala/sqrt2.scala>)
        -   [Factorial
		    ](<SICP\_examples/Scala/factorial.scala>)
        -   [Fibonacci
		    ](<SICP\_examples/Scala/fibonacci.scala>)
        -   [Exponentiation
		    ](<SICP\_examples/Scala/exponentiation.scala>)
        -   [Greatest common divisor
		    ](<SICP\_examples/Scala/gcd.scala>)
		
    #.  Higher-order functions in Scala

        -   [Summation (takes function arguments)
		    ](<SICP\_examples/Scala/summation.scala>)
        -   [Derivative (returns function result)
		    ](<SICP\_examples/Scala/derivative.scala\>)

    #. Lua versions
	
	    -   [Square root (Newton's Method) 
		    ](<SICP\_examples/Lua/sqrt.lua>)
        -   [Factorial
		    ](<SICP\_examples/Lua/factorial.lua>)
        -   [Fibonacci
		    ](<SICP\_examples/Lua/fibonacci.lua>)
        -   [Exponentiation 
		    ](<SICP\_examples/Lua/exponentiation.lua>) 
        -   [Greatest common divisor
		    ](<SICP\_examples/Lua/gcd.lua>)
        -   [Summation
		    ](<SICP\_examples/Lua/summation.lua>)
        -   [Derivative
		    ](<SICP\_examples/Lua/derivative.lua>) 

    #.  Also various 
	    [Haskell](<SICP\_examples/Haskell/>), 
	    [Elixir](<SICP\_examples/Elixir/>), 
	    [Elm](<SICP\_examples/Elm/>), and
	    [Scheme](<SICP\_examples/Scheme/>)
		versions


## Unprocessed Old Materials

301.  [Notes on Recursion Concepts and Terminology 
    ](RecursionConcepts.html)

#.  [Notes on Functional Program Evaluation Concepts 
    ](EvaluationConcepts.html)

#.  Jim Weirich. "Rake Tutorial," "Rake User Guide," and 
    "Rake by Example," 2005.\
    (Basic ideas discussed.) 
	\[[Ruby Rake web site](<http://docs.rubyrake.org>)\]

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

#.  Jamis Buck. Writing Domain Specific Languages,
    `the { buckblogs :here }`, 20 April 2006.\
    \[[blog entry
	](<http://weblog.jamisbuck.org/2006/4/20/writing-domain-specific-languages)\]
