25 lines
728 B
C++
25 lines
728 B
C++
#include "ast.hpp"
|
|
#include "pattern.hpp"
|
|
#include "parser.hpp"
|
|
#include "gmachine.hpp"
|
|
|
|
int main() {
|
|
try {
|
|
lily::program_ptr prog = lily::parse(
|
|
"defn other x y = { 3 }\n"
|
|
"defn otherr x y = { let sum = { x + y } in { sum + sum } }\n"
|
|
);
|
|
std::map<std::string, std::vector<lily::instruction*>> into;
|
|
lily::instruction_manager mgr;
|
|
prog->compile(mgr, into);
|
|
for(auto& pair : into) {
|
|
std::cout << pair.first << std::endl;
|
|
for(auto& op : pair.second) {
|
|
std::cout << " " << *op << std::endl;
|
|
}
|
|
}
|
|
} catch(lily::error& e) {
|
|
std::cout << e.message << std::endl;
|
|
}
|
|
}
|