Skip to content

Compile-time Lazy K interpreter with C++17 template metaprogramming (monadic implementation)

Notifications You must be signed in to change notification settings

falgon/mpl-lazyk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mpl-lazyk

CI

"Use template metaprogramming only when you really need to"
C++ Core Guidelines

mpl-lazyk is a monadic and impractical compile-time lazyk interpreter with template metaprogramming. This is achieved by implementing a simple parser combinator consisting of a monad transformer and either monad. The implementation and naming of many of these algebraic data structures is influenced by the programming language Haskell and category theory.

Run

Build and run

$ cd app
$ make LAZYK_CODE='"(SKK)I"' INPUT='"Hello, world!"'
Hello, world!

Or inside the docker container...

$ docker-compose -f docker/docker-compose.yml run lazyk
Hello, world!
$ INPUT="Que Sera, Sera" LAZYK_CODE="(SKK)I" docker-compose -f docker/docker-compose.yml run lazyk
Que Sera, Sera
$ INPUT="Que Sera, Sera" LAZYK_CODE="****i*i*i*ii*ii*ii11111110001111111110000011111111100000" docker-compose -f docker/docker-compose.yml run lazyk
Que Sera, Sera

Tests

Build and run

$ cd tests
$ make

Or inside the docker container...

$ docker-compose -f docker/docker-compose.yml run test

FYI

  • There is my blog post about this implementation (Japanese)
  • If you enojoy this, write your impressions on reddit!