Simple string interpolation using OCaml’s ppx extension points API.
Write [%str “some string”] anywhere a string expression is expected. Use
let name = "mario" in
print_string [%str "It's a meee, $(name)\n"]
See directory src_test for examples on what to do and not to do.
- install OCaml 4.02 (or newer)
- install opam 1.1.1 (or newer)
- install dependencies opam install sedlex ppx_tools ppx_deriving
- make all
Test by running ‘make test’
- support arbitrary OCaml expressions inside $(…). Needs to run the OCaml lexer on the string, skip over balanced parenthesis and pass this to OCaml Parse.expression.
Mail to jan@sheijk.net for questions and comments.