% CSci 450: Organization of Programming Languages \
  Exploring Languages using Interpreters and \
  Functional Programming
% **H. Conrad Cunningham** 
% **16 April 2018**
 
Copyright (C) 2016-2018, H. Conrad Cunningham 

**Acknowledgements:** I adapted and revised much of this work in
Summer and Fall 2016 and Spring 2017 from my previous materials. I
added new materials in Spring and Summer 2017. This is an ongoing
effort that will continue through at least Fall 2018.

In Spring 2018, I linked in modified Programming Paradigms and
Abstraction documents that will be included in a future draft of this
material. I also changed to my new working title for this work.

I maintain these notes as text in 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
April 2018 is a recent version of Firefox from Mozilla.


# Exploring Languages using Interpreters and Functional Programming

## Chapter 0: Course Introduction

-   **Not updated for Programming Languages course**
    \[[HTML](<00Course.html>)\]
    \[[PDF](<00Course.pdf>)\]


## Chapter 1: Fundamental Concepts 

-   \[[HTML](<01Fundamental450.html>)\]
    \[[PDF](<01Fundamental450.pdf>)\]

-   Partially reorganized material in Spring 2018 (I plan to break old
    chapter 1 into two chapters and an appendix. This is a new draft
    of the second part.)

    -   Programming Paradigms (drawn from old sections 1.3, 1.4, 1.7)
	    \[[HTML](<ProgrammingParadigms.html>)\]
        \[[PDF](<ProgrammingParadigms.pdf>)\]

-   Supplementary slides:

    -   [Evolving Computer Hardware Affecs Programming Languages (HTML) 
		](<slides/EvolvingHardwareSlides.html>)
    -   [Primary Programming Paradigms (HTML)
	    ](<slides/PrimaryParadigmsSlides.html>) 
    -   [History of Programming Languages (HTML)
	    ](<slides/HistorySlides.html>) 


## Chapter 2: Basic Haskell Functional Programming

-   \[[HTML](<02BasicHaskell450.html>)\]
    \[[PDF](<02BasicHaskell450.pdf>)\]

-   Partially reorganized material in Spring 2018 (I plan to break
    old chapter 2 into two chapters. This is a draft of the second part.)

    -   Abstraction (drawn from old sections 1.6, 2.5, 2.6, 2.7)
	    \[[HTML](<Abstraction/Abstraction.html>)\]
	    \[[PDF](<Abstraction/Abstraction.pdf>)\]

-   Supplementary slides:

    -   [Our First Haskell Functions (HTML) 
		](<slides/FirstHaskellSlides.html>) 
    -   [Top-Down Stepwise Refinement (HTML) 
	    ](<slides/StepwiseRefinementSlides.html>) 
    -   [Using Data Abstraction (HTML) 
        ](<slides/DataAbstractionSlides.html>) 

## Chapter 3: Evaluation and Efficiency 

-   \[[HTML](<03EvalEff450.html>)\]
    \[[PDF](<03EvalEff450.pdf>)\]

-   Supplementary slides:

    -   [Evaluation of Functional Programs (HTML) 
		](<slides/EvalModelSlides.html>) 
    -   [Recursion Styles (HTML) 
		](<slides/RecursionStylesSlides.html>) 

## Chapter 4: List Programming 

-   \[[HTML](<04Lists450.html>)\]
    \[[PDF](<04Lists450.pdf>)\]

-   Supplementary slides: 

    -   [List Programming (HTML) 
		](<slides/ListProgrammingSlides.html>) 

-   Supplementary notes used Spring 2017

    -   [Candy Bowl ADT Semantics 
        ](<../CandyBowl/Lua/candybowl_semantics.html>) 

-   Possible future material on modular programming based on:

    -   [Lecture Notes on Modular Design 
        ](<../ModularDesign.html>) 
    -   [Lecture Notes on Data Abstraction 
        ](<../DataAbstraction.html>) 
    -   [Labelled Digraph Abstract Data Type 
        ](<../Digraph/Haskell/DigraphADT.html>) 
    -   [Cookie Jar ADT Problem Description (Scala) 
        ](<../CookieJar/Scala/CookieJar_problem.html>) 

## Chapter 5: Higher-Order Functions

-   \[[HTML](<05HigherOrder450.html>)\]
    \[[PDF](<05HigherOrder450.pdf>)\]

-   Supplementary slides: 

    -   [Higher-Order List Programming 
	    ](<slides/HigherOrderFunctionsSlides.html>) 

    -   [Haskell Function Concepts 
	    ](<slides/FunctionConceptsSlides.html>) 

-   TBD: Regular expression combinators

## Partial Chapter 6: Developing Functional Programs 

-   \[[HTML](<06Developing450.html>)\]
    \[[PDF](<06Developing450.pdf>)\]


## Partial Chapter 7: More List Processing and Problem Solving 

-   \[[HTML](<07MoreLists450.html>)\]
    \[[PDF](<07MoreLists450.pdf>)\]


## Partial Chapter 8: Algebraic Data Types 

-   \[[HTML](<08AlgDataTypes450.html>)\]
    \[[PDF](<08AlgDataTypes450.pdf>)\]

-   Supplementary slides: 

    -   [Algebraic Data Types ](<slides/AlgDataTypesSlides.html>) 

## Partial Chapter 9: Type Classes 

-  \[[HTML](<TypeClasses450.html>)\]
   \[[PDF](<TypeClasses450.pdf>)\]

-   Supplementary slides: 

    -   [Overloading and Type Classes ](<slides/TypeClassSlides.html>) 


## Chapter 10: Expression Language Syntax and Semantics

-  \[[HTML](<../ExprLang/10ExprLangSynSem.html>)\]
   \[[PDF](<../ExprLang/10ExprLangSynSem.pdf>)\]
	
-   Modules

    -   [Abstract Syntax module ](<../ExprLang/AbSynExpr.hs>) 
    -   [Evaluator module ](<../ExprLang/EvalExpr.hs>) 
    -   [Environments module ](<../ExprLang/Environments.hs>) 
    -   [Values module ](<../ExprLang/Values.hs>) 
    -   [Process AST module (in work) 
	    ](<../ExprLang/ProcessAST.hs>)
        (simplfication and derivation on ASTs)


## Chapter 11: Expression Language Parsing

-  \[[HTML](<../ExprLang/11ExprLangParsing.html>)\]
   \[[PDF](<../ExprLang/11ExprLangParsing.pdf>)\]

    Supplemental slides: 
	
	-   [Expression Language Parsing 
	    ](<../ExprLang/ExprLangParsingSlides.html>) 

-   Common modules (Chapters 10 and 11)

    -   [Lexical analyzer module ](<../ExprLang/LexExpr.hs>)
    -   [Abstract Syntax module ](<../ExprLang/AbSynExpr.hs>)
    -   [Evaluator module ](<../ExprLang/EvalExpr.hs>)
    -   [Environments module ](<../ExprLang/Environments.hs>)
    -   [Values module ](<../ExprLang/Values.hs>) 
	
-  Prefix syntax specific modules

    -   [Prefix REPL module ](<../ExprLang/PrefixExprREPL.hs>)
    -   [Recursive descent parser for prefix expression language 
        ](<../ExprLang/ParsePrefixExpr.hs>)
    -   [Test Prefix (in work, not current) 
	    ](<../ExprLang/TestPrefix06.hs>) 
    -   [Prefix REPL module      ](<../ExprLang/PrefixExprREPL.hs>) 

-   Infix syntax specific module

    -   [Infix REPL module ](<../ExprLang/InfixExprREPL.hs>)
    -   [Recursive descent parser for infix expression language 
        ](<../ExprLang/ParseInfixExpr.hs>) (simple expressions)
    -   [Test Infix (in work, not current) 
	    ](<../ExprLang/TestInfix03.hs>) 

-   Other modules

    -   [Parser combinators module (in work) 
	    ](<../ExprLang/ParserComb.hs>)
    -   [Test parser combinators (in work) 
	    ](<../ExprLang/TestParserComb.hs>)
    -   [Process AST module (in work) 
	    ](<../ExprLang/ProcessAST.hs>)
        (simplfication and derivation on ASTs, chapter 10)
    -   [Stack Virtual Machine module (in work) 
	    ](<../ExprLang/SInstr01.hs>)
		(code generation, chapter 10)
    -   [Parser Combinators module ](<../ExprLang/ParserComb.hs>) 



## Partial Chapter 12: Expression Language Compilation

-  \[[HTML](<../ExprLang/12ExprLangCompiling.html>)\]
   \[[PDF ](<../ExprLang/12ExprLangCompiling.pdf>)\]
	
-   Code in work

    -   [Stack Virtual Machine? ](<../ExprLang/SInstr01.hs>) 


## Chapter 13 in Work: Imperative Core Language 

-   [Imperative Core Language Case Study ](<../ImpCore/ImpCore.html>)
    (does not exist yet as of 27 Sep)
	
- Interpreter modules (prefix syntax) code mostly works but needs a
  bit of update to match recent changes to Expression Language

    -   [REPL module ](<../ImpCore/ImpCore.hs>) 
    -   [Recursive descent parser module
	    ](<../ImpCore/ParseImpCore.hs>)
    -   [Lexical analyzer module ](<../ImpCore/LexImpCore.hs>) 
    -   [Abstract Syntax module](<../ImpCore/AbSynImpCore.hs>) 
	-   [Evaluator module ](<../ImpCore/EvalImpCore.hs>) 
    -   [Environments module ](<../ImpCore/Environments.hs>) 
    -   [Values module](<../ImpCore/Values.hs>) 
    -   [Test Imp Core(in work, not current) 
	    ](<../ImpCore/TestImpCore.hs>) 

## Future Chapters? More Languages and Interpreters 

-   TBD: Add function definitions and calls, local variables 
-   TBD: Simple Imperative Core Language 
-   TBD: Simple Lisp/Scheme language 
-   TBD: Modular/OO language 
-   TBD: Lazy language 
-   TBD: Compilation 
-   TBD: Continuations 

## Future Chapters? Using Algebraic Data Types

-   TBD: Error handling with `Maybe` and `Either` --
    [Handling Errors Without Exceptions (Scala) 
	](<https://john.cs.olemiss.edu/~hcc/csci555/notes/FPS04/ErrorHandling.html>) 

-   TBD: Regular Expressions using algebraic data types 

-   Not used Spring 2017

    -   [Framework Design Using Function Generalization: 
        A Binary Tree Traversal Case Study 
    	](<https://john.cs.olemiss.edu/~hcc/papers/BinTreeFramework.pdf>) 
    -   [Mealy Machine Simulator ](<MealyMachineSimulator.html>) 
    -   [Labelled Digraph Abstract Data Type 
        ](<../Digraph/Haskell/DigraphADT.html>) 

## Partial Chapter: Domain Specific Languages 

-   [Domain Specific Languages 
    ](<../DomainSpecificLanguages.html>) 

-   Sandwich DSL Case Study 
    -   [Haskell version ](<../SandwichDSL/Haskell/SandwichDSL.html>) 
	-   [Scala version ](<../SandwichDSL/Scala/SandwichDSL.html>) 
    -   [old Lua version 
        ](<http://john.cs.olemiss.edu/~hcc/csci555/notes/SandwichDSL/Lua/sandwich_model.lua>) 
	
-   DSL in other languages (not used Spring 2017) 

    -   State Machine DSL (Scala) 
    -   Lair DSL (Lua) 
    -   Survey DSL (Ruby) 
    -   Computer Configuration DSL (Scala) 
	-   Email DSL (Scala) 

## Future Chapter? Input/Output 

## Future Chapter? Testing

## Partial Chapter: Algebras, Laws, and Synthesis

-   TBD: Discussion of functors, applicative functors, and monads 
    (perhaps semigroups and monoids) -- perhaps use `Maybe`

-   From [*Notes on Functional Programming with Haskell* 
    ](<../haskell_notes.pdf>):

    -   Chapter 11, Haskell Laws 
    -   Chapter 12, Program Synthesis 


## Partial Chapter: Reduction Models

-   From [*Notes on Functional Programming with Haskell* 
    ](<../haskell_notes.pdf>):

    -   Chapter 13, Models of Reduction 
    -   Chapter 14, Divide and Conquer


## Partial Chapter: Infinite Data Structures

-   [Strictness and Laziness (Scala) 
    ](<https://john.cs.olemiss.edu/~hcc/csci555/notes/FPS05/Laziness.html>) 

-   From [*Notes on Functional Programming with Haskell* 
    ](<../haskell_notes.pdf>):

    -   Chapter 15, Infinite Data Structures 

## Future Chapters? Games

-   [Wizard's Adventure game (Elixir)
    ](<../Wizard/Elixir/wizards_game2a.ex>)

-   [Dice of Doom (Elixir)
    ](<../Dice_of_Doom/Elixir/dice_of_doom_v2a.ex>)


## Future Chapter? Concurrency

-   TBD


## Future Chapter? Parallelism

-   TBD


## Future Chapter? Reactive Programming

-   TBD

