2019-06-04 20:45:06 -07:00
|
|
|
#include "ast.hpp"
|
|
|
|
#include "pattern.hpp"
|
|
|
|
#include "parser.hpp"
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
try {
|
2019-06-05 21:16:40 -07:00
|
|
|
lily::parse(
|
|
|
|
"data Bool = { True, False }\n"
|
|
|
|
"data Color = { Red, Black }\n"
|
2019-06-05 21:36:30 -07:00
|
|
|
"data IntList = { Nil, Cons(Int, IntList) }\n"
|
2019-06-09 19:57:58 -07:00
|
|
|
"defn other x y = { 3 }\n"
|
2019-06-09 20:24:44 -07:00
|
|
|
"defn add x y = { x + y }\n"
|
2019-06-09 21:25:02 -07:00
|
|
|
"defn ones = { Cons 1 ones }\n"
|
|
|
|
"defn len l = { case l of { Nil -> { 0 } Cons(x, xs) -> { 1 + len xs } } }");
|
2019-06-04 20:45:06 -07:00
|
|
|
} catch(lily::error& e) {
|
|
|
|
std::cout << e.message << std::endl;
|
|
|
|
}
|
|
|
|
}
|