Meow lang is a programming language that compiles to catlet, another language that is hard to read but easy to execute. Meow's syntax is easier to read than catlet, but meow and catlet are equivalent.
The only operation is doing "let" (cat can be implemented by let).
Its main design purpose is to do experiments with "string substitution".
Currently the definition of substitution of strings are defined by the built-in replace
function of String
.
It's not allowed to do
There are no functions in Meow. Instead, we have macros. A macro is a piece of code that can be evaluated to a string.
The only available data type is String. (However, you can encode other data types inside String)
Meow:
encode(s) {
var rep = {
"$" = "\$";
"#" = "\#";
"\" = "\\";
s
};
"#$"+ rep +"$#"
}
fib(x) {
if(
eq0(x),
0(),
if(
leq(x, 2()),
1(),
add(
fib(pred(x)),
fib(pred(pred(x)))
)
)
)
}
Catlet (Compiled result):
encode s = cat cat "#$" let "$" "\$" let "#" "\#" let "\" "\\" s "$#"
fib x = if eq0 x 0 if leq x 2 1 add fib pred x fib pred pred x
# First clone this repo and open it
cargo run repl
# Now you can use the REPL to evaluate (catlet) expressions
Example:
> "abc"
abc
> cat "hello " "world"
hello world
> let "apple" "world" "hello apple"
hello world