diff --git a/src/main.cpp b/src/main.cpp index 3056dfa..a30c30b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3,18 +3,15 @@ #include "parser.hpp" #include "gmachine.hpp" #include "llvm.hpp" +#include int main() { try { + std::ostringstream oss; + oss << std::cin.rdbuf(); + std::string input = oss.str(); - lily::program_ptr prog = lily::parse( - "data IntPair = { MkPair(Int, Int) }\n" - "data IntList = { Nil, Cons(Int, IntList) }" - "defn fst p = { case p of { MkPair(a, b) -> { a } } }\n" - "defn snd p = { case p of { MkPair(a, b) -> { b } } }\n" - "defn sum l = { case l of { Nil -> { 0 } Cons(x, xs) -> { x + sum xs } } }\n" - "defn main = { let tl1 = { Cons 1 Nil } in { let tl2 = { Cons 2 tl1 } in { let tl3 = { Cons 3 tl2 } in { sum tl3 } } } }" - ); + lily::program_ptr prog = lily::parse(input); prog->gen_llvm(); } catch(lily::error& e) { std::cout << e.message << std::endl;