(22 Aug) Discuss syllabus and class organization
Discuss fundamental programming language concepts [HTML] [PDF]
Concepts: programming language paradigm, imperative language, declarative language, functional language, relational or logic language; program state, implicit versus explicit state; execution of commands versus evaluation of expressions, history of programming languages
(24, 26 Aug) Focus on the sections 1.2, 1.3., and 1.5 for now. We address section 1.4 later.
(26, 29 Aug) History of Programming Languages HTML slides (slides for section 1.5 material in above notes)
(29, 31 Aug) Discuss textbook Chapter 1 slides beginning with Compilation and Interpretation on slide 14
Concepts: TBD (examine the notes and textbook chapter)
Introduce Lua programming language (part 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.
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.
(31 Aug; 2, 9, 12 Sep) Introduction to Lua slides based, in part, on Mascarenhas slide sets 0-5
Concepts: Lua design principles, REPL, chunk, script, data types and operators (e.g.,
nil
,boolean
,number
,string
,table
,function
), dynamic vs. static typing, first-class functions (first-class, anonymous, variadic, multiple return), statements (multiple assignment,if
,while
,repeat
, numericfor
, genericfor
,do
), tables (as array, matrix, record, set)
Examine Expression Language 1 for Assignment 1
Purposes: The purposes of this case study and assignment are (a) to examine the design and implementation of a simple expression language that includes integer values, variables, arithmetic operators, relational comparison operators, and conditional statements and (b) to use the Lua programming concepts learned in the early part of the semester to extend the implementation. Although not part of the assignment, the interpreter also exhibits modularization and use of the LPEG parsing library.
Concepts: expression, concrete and abstract syntax, parsing, environment, evaluation, modularization in general, using Lua modules, using Lua tables to represent "algebraic data types" (as in the abstract syntax), read-evaluate-print-loop (REPL)
(7-16 Sep) Monolithic script file (expr01.lua) given with Assignment #1
(21 Sep) Modularized source code (new baseline after assignment)
Modules:Scripts to execute and test:
(14 Sep) Examine Square Root case study (stepwise refinement)
Concepts: TBD (examine the notes to see what was covered)
Example motivated by sections 1.1.7 and 1.1.8 from: Harold Abelson and Gerald J. Sussman with Julie Sussman. Structure and Interpretation of Computer Programs, Second Edition, MIT Press, 1996
(for reference) Examine a natural number arithmetic package
Notes:
We did not cover this example explicitly in 2016, but the Lua implementation is an example of Lua programming using tables, data abstraction, and recursion. The file contains both the function definitions and a partial test script. I did not modularize the Lua code, but I did implement it so that the primitive representation/operations layer can separated into a module used by the outer, nonprimitive operations layer, which can itself be a separate module used by clients (such as the partial test script).
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. In particular, the Java implementation should be accessible to Ole Miss CS students.
The Lua and Elixir implementations are not "object-oriented', but the Java, Ruby, and some of the Scala versions are object-oriented.
Concepts: Natural numbers, Peano arithmetic; functional programming, data abstraction, use of Lua tables and modules; (Scala, Ruby, and Java versions use object-oriented design patterns such as Composite, Singleton, and Null Object)
Background on Peano arithmetic
Peano Axioms, Wikipedia article
Peano's Axioms, Wolfram MathWorld article
Background on software design patterns
Elixir version (2015)
Scala versions (2012)
Java version (2004, minor mods 2016), simpler, no generics
Introduce Lua programming language (part 2)
Concepts: lexical scope, higher-order functions, closure, callback, functional programming (
map
,filter
, folds) Currying, partial application
Concepts: module, information hiding, interface, abstract interface, module and interface design criteria, Lua module implementation
(19-21 Sep) Examine Rational Arithmetic case study (data abstraction)
Example motivated by sections 2.1.1 and 2.1.2 from: Harold Abelson and Gerald J. Sussman with Julie Sussman. Structure and Interpretation of Computer Programs, Second Edition, MIT Press, 1996
Concepts: designing modules with multiple implementations, data abstraction barrier ("building the wall"), canonical forms, using Lua modules, using higher order functions, using closures/thunks to encapsulate data
Rational arithmetic module -- outer layer implementation of Rational Arithmetic abstraction
Rational number data representation using two-element arrays -- primitive layer implementation 1
[module] [test script]
Rational number data representation using array but deferring GCD -- -- primitive layer implementation 2
[module] [test script]
Rational number data representation using closures -- primitive layer implementation 3
[module] [test script]
(21 Sep) Examine modularized code above for Expression Language 1
(for reference) Study a Lua expression tree parser using LPEG
Note: This example is similar to the Expression Language 1 infix parser. However, this example does not have the relational operators or the if-expression from the Expression Language, but it does have function call syntax. I began with this code from 2013 when I was developing the infix parser.
(23-28 Sep) Examine Imperative Core (ImpCore) language for Assignment #2
Study code for ImpCore interpreter
Modules:
Run and test scripts:
Modules and scripts revised to handle multi-expression scripts (added 20 Oct, after assignment):
(28 Sep) The planned exam was rescheduled for Friday, 30 Sep. We examined the ImpCore syntax and semantics, studied the LPEG-based Parser module, traced the ImpCore feature changes through the Parser, Abstract Syntax, and Evaluator modules.
(23-28 Sep) Discuss examination #1 rescheduled for Friday, 30 September
Examination #1 was rescheduled for Friday, 30 September. It will cover all material covered in the notes, slides, and examples above.
Examples below such as the functions from SICP, Carrie's candy bowl, Lua "cell" lists, and complex numbers also illustrate the concepts and techniques we have used.
(30 Sep) Take Examination #1
(3 Oct) Return and discuss Examination #1
(5-7 Oct) Discuss Lua Metatables -- slides based, in part, on Mascarenhas slide set 10
Concepts: metatable; metamethod; Lua metatable & metamethod-related functions; shared metatable; overriding operation behavior; use of metamethods such as
__add
,__len
,__eq
,__lt
,__le
,__index
,__newindex
, and__tostring
; proxy tables example
Discuss other programming paradigms
(7-12 Oct) Procedural, modular, and (primarily) object-oriented paradigms (Section 1.4 of Fundamental Concepts document)
Concepts: procedural programming/language; modular programming/language; object-oriented programming/language; object model; objects with state, operations, identity, encapsulation, and independent lifecycle; mutable and immutable objects; object-based language; class; instances/objects; type; class-based language; dynamic and duck typing; inheritance; base/parent/superclass; child/derived/subclass; generalization and specialization; multiple inheritance; interfaces and implementations; substitution principle for subclasses; polymorphism (see separate handout); dynamic binding; overriding; object-oriented language; prototype-based language; prototype; delegation rather than inheritance; slots; how does Java fit? Lua?
Concepts: polymorphism, ad hoc polymorphism, overloading, subtyping (subtype polymorphism, polymorphism by inclusion, polymorphism by inheritance), parametric polymorphism (generics), early and late binding, polymorphism in dynamically typed languages
CSci 555 Notes on this topic from which the above was adapted
Concepts: a simple Lua object model; Lua tables as objects; method; receiver object; colon method call operator; self; syntactic sugar; Lua classes as modules; using metatables and metamethod
__index
to construct classes and superclasses; constructor; class method; instance method; examples of classes and superclasses; instance-of;
(10-12 Oct) Discuss Assignment #3 on simplification of abstract syntax trees
Concepts: simplification of abstract syntax trees to enable more efficient interpretation and code generation, recursive programming of multiway tree data structures, preserving the semantics of expressions, side effects of expression evaluation/execution, more on the structure of language processors
Examine Arithmetic Expression Tree program skeletons (Lua)
These are program skeletons provided for course assignments in 2013 and 2014. They involve symbolic differentiation as well as evaluation and simplification of arithmetic expression trees. So the expression trees differ somewhat from those used in the interpreters. However, the general recursive approach is the same as used in Assignment #3. The object-oriented versions are similar to Assignment #4 in this course.
Background reading: Programming in Lua (PiL), Chapter 11 of the First, Second, or Third Edition or Chapter 14 of the Fourth Edition, for table-based implementations of various data structures in Lua
(7 Nov for Assignment #4 questions) Recursive Functions with Record Representation (exprRecFuncRecord.lua)
(7 Nov for Assignment #4 questions) Functions with List Representation (exprRecFuncList2.lua)
(17 Oct) Function Table with List Representation and Evaluation Table (exprEvalTable2.lua).
Purpose: I include this example here because of its use of an "evaluation table" (
evalTab
) in the evaluation function and the "derivation table" (derivaTab
) in the differentiation function. Instead of using large if-elseif-else structures, this version uses "hash" tables indexed by the node type tag. (So it is likely more efficient as the number of tags gets large.) The values stored in the tables are the function closures to be executed. This approach uses the__index
metamethod to try invalid accesses.
Useful extensions: Use a shared metatable for all expression tree "objects" created by the constructor functions. This would allow
isExp
to be reimplemented to check the existence of the metatable and also allowtostring
to be delegated to thevalToString
function directly.
Background reading: Programming in Lua (PiL), Chapter 16 of the First, Second, or Third Edition or Chapter 21 of the Fourth Edition, for object-oriented programming in Lua
Prototype Object-Based (exprObjBased.lua) -- uses Lua method calls, tables, metatables, and
__index
metamethod to implement "classes" but not inheritance
Concepts: prototype object; class; constructor (factory method); Lua method calls using
:
(colon); Singleton design pattern
Object-Oriented with Inheritance (exprObjInherit2.lua) -- extends the above example to implement an "abstract" superclass and inheritance
Concepts: prototype object; class; subclass (child class) superclass (parent or base class); abstract and concrete classes, single inheritance, abstract (deferred) methods; constructor (factory method); accessor and mutator methods; proxy object; method injection; Singleton, Null Object, and Template Method design patterns
with string and table captures (exprParser.lua)
adding semantic action function (exprParserSemantic.lua)
(21-24 Oct) Study the Movable and Named Objects case study (in Lua but based on a Haskell case study by Thompson)
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.
Concepts: prototype object; class; subclass (child class) superclass (parent or base class); abstract and concrete classes, single and multiple inheritance, abstract (deferred) methods; constructor (factory method); accessor and mutator methods; proxy object; method injection; template method design pattern (template and hook methods); Singleton and Null Object design patterns;
Background reading on object-oriented programming languages: Object-oriented subsection of the Fundamental Concepts of Programming Languages notes
(for reference) 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.
(for reference) First Lua version (movable.lua)
Modularized Lua version with improved class support:
class support module (class_support.lua)
module using class-support (movable2.lua)
test driver (movable2Test.lua)
(for reference) Study the prototype-based programming example
Comments: Lua is essentially a prototype-based programming language. A Lua table has its own state, a unique identity, and an independent lifecyle. By assigning function closures to identifier-style keys, a table can also have its own operations. The method-call syntax enables these operations to refer to its associated table conveniently.
The Lua metatable and metamethod features enable a table to delegate some of its work conveniently to other tables. In particular, the __index
metamethod enables accesses to data fields or operations not defined in one table to other tables.
The previous "object-oriented" Arithmetic Expression Tree and Movable & Named Objects examples use Lua's prototype-based features to implement classes and inheritance structures.
This module uses those features in a more straightforward prototype-based approach--by creating a "copy" of the prototype object. It provides two constructor functions, set up to use the method-call syntax.
Constructor method Prototype:new
creates a new object as a shallow copy of the table parameter mixin
with other references delegated to object self
. A call Prototype:new
creates a basic object that delegates to object Prototype
. If obj
has been created by this new
method, then a call of obj:new
creates a new object that delegates to obj
rather than Prototype
. (This is different from the way Lua classes are implemented.)
Constructor method Prototype:clone
creates a new object that is a shallow copy of object self
and then mixes in the fields and methods from mixin
. It delegates accesses to any undefined fields to whatever object self
does.
Concepts: Prototype object, delegation, shallow copy, mixin
(24 Oct) Introduce concept of metaprogramming ("writing code that writes code")
Definition (Wikipedia): Metaprogramming is the writing of computer programs with the ability to treat programs as their data. It means that a program could be designed to read, generate, analyse and/or transform other programs, and even modify itself while running.
Definition: Reflexive metaprogramming is the writing of computer programs that manipulate themselves as data.
Concepts: Metaprogramming, metalanguage, object language, reflection (reflectivity), homoiconicity.
dynamic class loaders, reflection API, annotation processing, dynamic method invocation (JVM feature), JVM bytecode manipulation (mostly with external tools), etc.
metatables, metamethods, manipulation of environments, debug library (introspection/reflection features),
loadfile
andloadstring
functions to dynamically execute code, extensions in C, etc.
(26 Oct, 7 Nov) Discuss Assignment #4
This assignment expects the solution to use the "object-oriented" or "prototype-based" approach in Lua, as discussed in this course.
That is, each expression "subclass" (e.g., Add
) should have an eval
method that evaluates that particular type of expression object. The selection of which method to execute should not be determined by an if-then-else construct but by the "dynamic binding" of the method call to the appropriate implementation. This is the approach that is considered a "best practice" in an object-oriented language such as Java.
The examples below illustrate this in various languages.
The references below discuss design principles for object-oriented programs. In particular, the open-closed principle is relevant.
(7 Nov) I discussed Assignment #4 using the Arithmetic Expression Tree background examples below.
Background on object-oriented design:
SOLID Design Principles a look at the core SOLID principles through the lens of modularity.
"Uncle" Bob Martin video on "SOLID Principles of Object-Oriented and Agile Design"
Background examples:
This set of examples gives skeletons for an assignment in another course that is similar to this assignment. The modular list- and record-based versions illustrate approaches similar to the modularized ImpCore interpreter. The object-oriented version object-oriented versions give partial solutions that illustrate an approach that can be taken to Assignment #4.
Natural Numbers example above, especially the object-oriented Java, Scala, and Ruby versions. The Lua version was not implemented with object-oriented techniques in mind.
Prototype-based example above (added after the assignment was given).
This version does not implement classes or inheritance, but shows how a delegation to a prototype object or cloning a prototype can accomplish much the same.
The approach taken in the Complex Arithmetic implementation is a bit different from the the other object-oriented examples. The superclass has a constructor
new
and two "factory" methods. Each subclass implements the two "factory" methods that create complex numbers depending on the chosen coordinate system. The superclass factory methods call down to the like-named factory methods in the subclasses. This creates an unusual coupling down the class hierarchy that violates the open-closed principle for OO design. This structure should be reexamined in a future design.
class_support
module(26-8 Oct) Chapter 2 slides (slides 1-11 and 22-28)
The focus here is on slides 1-11 and 22-28, which cover the general aspects of language parsing but not the specific implementation techniques for scanners and parsers.
The course CSci 311 Models of Computation covers the theory of regular and context-free languages and related automata.
We implemented the scanner/parser functionality using the LPEG module in Lua. The processing of the language syntax is encapsulated within the Parser modules of our modularized Expression Language 1 and Imperative Core Language (ImpCore) interpreters. There is no separate scanner component.
LPEG grammars can parse deterministic context-free languages.
(31 Oct) Review for Exam 2 (Exam 2 moved to 2 Nov)
(2-4 Nov) Take Examination #2 (Take Home)
Exam 2 covers the material discussed in class since Exam #1 plus the Imperative Core Language interpreter (used in Assignments #2 and #3) and the instructor's introductory Lua slides (similar to the ones created by Dr. Fabio Mascarenhas).
Exam #2 will not cover textbook chapter 3 on "Names, Scopes, and Bindings" or the accompanying slides.
(4 Nov) Enjoy guest lecture on Elm programming by Nate Clark (Technical Direct, Base Camp Coding Academy)
Concepts: functional programming, Elm programming language, model-view-controller pattern, Elm architecture for front-end Web applications, algebraic data type
(for reference) An Introduction to Elm (GitBook)
(7 Nov) Review concepts for Assignment #4
Continue discussion of Elm language and programming
Concepts: functional programming, basic syntax and semantics of Elm, recursion, backward recursion, forward recursion, linear recursion, tail recursion, accumulating parameter
(7-11 Nov) Learn X in Y Minutes, X == Elm
Note: The Learn X in Y Minutes tutorial uses a few Elm features that do not seem to be in the current version of Elm (0.18). These are in Haskell and may have been in earlier versions of Elm.
The notation [1..5]
does not seem to be defined. We can use the function call List.range 1 5
instead.
Component extraction functions fst
and snd
for tuples do not seem to be defined. We can use functions Tuple.first
and Tuple.second
instead.
Instructor's examples
(16 Nov, mostly for reference) Review notes on recursion concepts
Concepts: forward and backward recursion, linear and nonlinear recursion, tail recursion, accumulating parameter, logarithmic recursion
Comment: Tail recursion is an important property of function definitions. It can sometimes be used to derive a more time-efficient algorithm. This is the case with the Fibonacci and Exponentiation series of examples.
Tail call optimization (or tail call elimination or proper tail calls) is a useful property of language implementations. It can result in more space-efficient algorithms by converting function calls into "loops" (e.g., by reusing the caller's stack frame).Moreover, this may make it possible to evaluate some expressions that otherwise would result in stack overflow.
Lua supports tail call optimization.
Elm probably supports tail call optimization in limited circumstances--some self-recursive calls can be translated to loops, but it does not support indirect recursions. (It is based on JavaScript; current implementations of JavaScript 5 do not usually support tail call optimization.)
(for reference) Elm Tutorial (GitBook)
(for reference) Awesome Elm tutorial list
(14-18, 28 Nov) Study Names, Scopes, and Bindings from PLP textbook Chapter 3: slides
(16 Nov) Discuss Assignment #5, which involves Elm programming. You likely will need to study the tutorials and examples
(18, 28 Nov) Study Subroutines and Control Abstractions form PLP textbook Chapter 9: slides
(28 Nov) Review for Exam 3
(30 Nov) Take Examination #3 (2 Dec) Take-Home Component
Exam #3 focuses on the content covered since Exam #2 including the Elm language and Elm programming techniques and chapters 3 and 9 of the textbook. Students should study the Elm tutorials and the notes on recursion concepts and work on Assignment #5 to become familiar with Elm.
Exam #3 will not explicitly cover the Lua object-oriented material from Assignment #4. However, the exam questions will assume that you are familiar with the programming language and programming techniques we have studied this semester and they will assume that you are familiar with Java (taken in prerequisite courses).
(2 Dec) Discuss Exam #3 and Final Examination
(7 Dec) Take Final Examination
(12 Dec) Enjoy Winter Break
EXTRA MATERIALS NOT EXPLICITLY COVERED FALL 2016
(for reference) Examine the complex number arithmetic modules in Lua
Modules are repeated in each package in which they are used
Rectangular coordinates modules:
[arithmetic] [rectangular representation] [utilities] [test driver]
Polar coordinates modules:
[arithmetic] [polar representation] [utilities] [test driver]
Tagged data modules: [arithmetic] [data tagging] [utilities] [test driver]
Data-directed programming modules:
[arithmetic] [rectangular representation] [polar representation] [data tagging] [utilities] [test driver]
Object-oriented modules:
[arithmetic] [utilities] [test driver]
(for reference Discuss Domain-Specific Languages, from instructor's lecture notes
Concepts: domain-specific languages (DSLs); DSLs versus general-purpose programming languages; external versus internal DSLs; shallow versus deep embedding of internal DSLs; use of algebraic data types to implement DSLs
(for reference) Discuss Sandwich DSL case study
DSL Builder module using function sequence pattern (sandwich_builder.lua)
(for reference) Discuss Fowler's Lair Configuration DSL in Lua
Background reading on case study:
Martin Fowler, One Lair and Twenty Ruby DSLs, Chapter 3, The ThoughtWorks Anthology: Essays on Software Technology and Innovation, The Pragmatic Bookshelf, 2008
Background reading on DSL patterns: DSL patterns catalog from Martin Fowler's book Domain Specific Languages, Addison Wesley, 2010
Caveat: Some of these DSL programs may depend upon features from Lua 5.1 that were changed in Lua 5.2 and 5.3.
Shared modules
Class support module (same as in Movable Objects case study)
class support module
Semantic Model
model module -- test driver
Internal DSLs
Global Function Sequence
builder module (builder08.lua) -- dsl script (rules08.lua) -- test driver (test08.lua)
Class Method Function Sequence with Method Chaining
builder module (builder11.lua) -- dsl script (rules11.lua)
Expression Builder with Method Chaining
builder module (builder14.lua) -- dsl script (rules14.lua) -- test driver (test14.lua)
Nested Closures
builder module (builder03.lua) -- dsl script (rules03.lua) -- test driver (test03.lua)
Expression Builder with Object Scoping and Method Chaining
builder module (builder17.lua) -- dsl script (rules17.lua) -- test driver (test17.lua)
Literal Collection
builder module (builder22.lua) -- dsl script (rules22.lua) -- test driver (test22.lua)
External DSL
(for reference) Chapter 4 slides
(for reference) Chapter 5 slides
(for reference) Chapter 6 slides
(for reference) Chapter 7 slides
(for reference) Chapter 8 slides
(for reference) Chapter 10 slides
(for reference) Chapter 11 slides
(for reference) Chapter 12 slides
(for reference) Chapter 13 slides
(for reference) Chapter 14 slides
(for reference) Chapter 15 slides
(for reference) Chapter 16 slides
(for reference) Chapter 17 slides
(for reference) Examine functions adapted from SICP
Stepwise refinement of Square Root function in Haskell (Section 2.5)
Lua versions (2013):
(for reference) Carrie's Candy Bowl modules in Lua
Purpose: Carrie's Candy Bowl case study illustrates design and implementation methods for abstract data types (ADTs) and information hiding modules in Lua. It gives formal interface implementation invariants for the ADT module and precondition and postcondition assertions for each function (operation).
Concepts: information-hiding module, interface, data representation, interface and implementation invariants for abstract data types (ADTs), preconditions and postconditions for ADT operations, mathematical bag
Background reading on modular programming: Lecture Notes on Data Abstraction
Caveat: These modules (from 2013-14) provide a common interface to the CandyBowl "type" with different underlying implementations. They do not internally separate the data representation into a separate module (or layer) as the Rational Arithmetic example does.
Hashed version (candybowl_hash.lua)
Unsorted list version (candybowl_list.lua)
Test driver (test_candybowl.lua)
(for reference) 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.)
Concepts: information-hiding module, interface, secret, changeability, data representation, interface and implementation invariants for modules (or abstract data types), preconditions and postconditions for functions, primitive operation (function), convenience operation (function), function closure, proxyBackground 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.
[module source] [source after cpp]
[test driver] [driver after cpp] [sh script]
[macro definitions] [module macro source] [source after luam -o]
[macro test driver] [driver after luam -o] [sh script]
Develop a Email Message Building Internal DSL using Method Chaining with Progressive Interfaces:
(for reference) Develop a State Machine Model and "Secret Panel" Controller External DSLs
State Machine Semantic Model
StateMachine.scala -- StateMachineTest.scala -- CommandChannel.scala (mock)
XML-based External DSL
StateMachineXMLTest .scala -- IncrementalStateMachineBuilder.scala -- input file SecretPanel.xml
Custom External DSL with a Delimiter-Directed parser
DelimiterDSLTest.scala -- IncrementalStateMachineBuilder.scala -- input file CustomExternalStateMachineDSL.dsl
Custom External DSL with handcoded Recursive-Descent parser
RecursiveDescentTest.scala -- IncrementalStateMachineBuilder.scala -- input file CustomExternalStateMachineDSL2.dsl
Custom External DSL (using Scala parser combinator library) with embedded state machine builder
CombinatorParserBuilderTest.scala -- IncrementalStateMachineBuilder.scala -- input file CustomExternalStateMachineDSL2.dsl
Custom External DSL (using Scala parser combinator library) with full AST construction
CombinatorParserASTTest.scala -- input file CustomExternalStateMachineDSL2.dsl --
Static C Code Generator with Model-Aware target platform library
StaticC _GeneratorTest .scala -- generated C output file output.c
Note: The needed framework code to run the C program is not yet available in this form. It needs to be reconstructed from Fowler's web site.
(for reference) Examine the Survey DSL
(for reference) CRuby version of Fowler's DSL framework
DSL Reader Framework module
ReaderFramework.rb source code
DSL Reader Utilities module, a mix-in used several places
ReaderUtilities.rb source code
Simple test data files
Data input file -- Text DSL description -- XML DSL description
Direct configuration and testing of Reader
BuilderDirect.rb source code
Single-pass text DSL configuration and testing
TextSinglePass.rb source code
Two-pass text and XML DSL configuration and testing
TwoPass.rb source code -- class BuilderExternal source code generated by TwoPass.rb
Ruby internal DSL configuration and testing
RubyDSL.rb source code
Harold Abelson and Gerald J. Sussman with Julie Sussman. Structure and Interpretation of Computer Programs, Second Edition, MIT Press, 1996. [HTML book]
William R. Cook. Anatomy of Programming Languages online draft
Shiram Krishnamurthi. Programming Languages: Application and Interpretation, online book
Fabio Mascarenhas. Programming in Lua, Slides for Course, Federal University of Rio de Janeiro, Brazil, July 2013. This course was delivered at Nankai University, P. R. China, in July 2013 using Lua 5.2.
Roberto Ierusalimshcy. Programming in Lua, First Edition, Lua.org, Rio de Janiero, Brazil, 2003. This old edition at https://www.lua.org/pil/contents.html covers Lua 5.0.
Penlight Lua Libraries inspired by the Python standard libraries
Love 2D game framework
Awesome Elm tutorial list
School of Haskell online tutorials
Miron Lipovaca. Learn You a Haskell for Great Good: A Beginner's Guide, a free online tutorial at http://learnyouahaskell.com/. (It is also in print from No Starch Press, 2011.)
H. Conrad Cunningham. Introduction to Functional Programming Using Haskell, Computer and Information Science, University of Mississippi, 2016 (partial draft), available from the prototype CSci 555 course site at http://www.cs.olemiss.edu/~hcc/csci555/prototype/. I begin developing this set of notes in June 2016 based partly on previous materials.
H. Conrad Cunningham. Notes on Functional Programming with Haskell, Computer and Information Science, University of Mississippi, 1994-2014. This older document is being revised and integrated with other materials to produce the document Introduction to Functional Programming Using Haskell.
Kees Doets and Jan van Eijck. The Haskell Road to Logic, Math and Programming, March 2004. This book is also available in print, published by College Publications, 2004.
Paul Hudak. The Haskell School of Music: From Signals to Symphonies, Version 2.6, January 2014. This book is a recent rewrite of Hudak's The Haskell School of Expression: Learning Functional Programming through Multimedia, Cambridge University Press, 2000.
Patrick Blackburn, Johan Bos, and Kristina Striegnitz. Learn Prolog Now. This a tutoral available online at http://www.learnprolognow.org/. It is also available in print from College Publications, 2006.