An interpreter for LOOP and WHILE written in F#.
Developed for the SWAFP (Applied functional programming) course at Aarhus University, this interpreter prioritizes demonstrating course concepts over performance. Both languages are fully implemented and can be used via the REPL or executed through the CLI.
There are some small bugs in the code, nevertheless the interpreter does its honest work.
- Monads and Functors
- Testing and recursive functions
- Reactive programming
- Monoids and Model/Type-based programming
- Akka (Actor model)
- Functional architecture
- Error handling and Railway oriented programming
- Persistent data structures
- Applicatives and functions
The concepts are defined by the course and are used as a base for the oral exam. For more information about the concepts, please refer to the course slides.
To use the interpreter, you can either run it in the REPL or execute it via CLI.
- REPL
dotnet run --project lwsharp
// Opens the REPL
> x10 := 10
Store: map [("x10", 10)]
> LOOP x10 DO x10 := x10 + 1 END
- CLI - (fun fact: it uses the actor model to execute the files in parallel)
dotnet run --project lwsharp -- file1.lw file2.lw
SUCCESS - /home/stdin/Documents/20-Aarhus/20-University/10-Courses/60-SWAFP-Assignment/lwsharp/lwsharp/examples/Loop.lw
x0 = 6
x1 = 1
x9 = 3
SUCCESS - /home/stdin/Documents/20-Aarhus/20-University/10-Courses/60-SWAFP-Assignment/lwsharp/lwsharp/examples/While.lw
x0 = 0
x1 = 0
x2 = 159200
Done
In case you have any questions, please feel free to reach out to me via email or create an issue in this repository.
Additionally, if you are interested in taking SWAFP feel free to reach out to me for more information about the course and the exam I might remember some parts of it or refer to the docs folder where I have the slides used at my oral exam.
Also if you have any feedback on the code, please let me know as this is my first F# project.
- Henrik Bitsch Kirk for the course at the Aarhus University
- Functors, Applicatives and Monads blogpost
- General F# Blogposts
- Mark Seemann's blog
