Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

60 lines (56 sloc) 1.644 kB
import "ast.pil"
import "parser.pil"
//import "evaluator.pil"
import "rewrite.pil"
import "core.pil"
import "primitives.pil"
import "pretty.pil"
import gel
import gelly::rewrite
void main(Array<String> args) {
initPrimitives();
String input = null;
//println(replaceMatchVar(new Parser("![ `exp ]").acceptExp()).toIndentedString(0));
println(new Parser("a++ + 7--").acceptExp().toIndentedString(0));
println(new Parser("a.b.c()").acceptExp().toIndentedString(0));
println(new Parser("a().b").acceptExp().toIndentedString(0));
println(new Parser("a().b()").acceptExp().toIndentedString(0));
//if(true) {
//return;
//}
/*if(args.length > 0) {
if(env.evalString("import \"" + args[0] + "\"")) {
println(pretty(env.currentTerm, 0));
} else {
println("Rewriting failed.");
}
} else {
*/
println("Welcome to gelly, type :q to quit.");
while(input != ":q") {
print("> ");
input = readln();
println(new Parser(input).acceptExp().toIndentedString(0));
/*
if(input != ":q") {
if(env.evalString(input)) {
println(env.currentTerm.toIndentedString(0));
} else {
println("Rewriting failed.");
}
}
*/
}
//}
/*
println(new Parser("if: 3 == 0").acceptExp().toIndentedString(0));
println(new Parser("if 3 + if 8").acceptExp().toIndentedString(0));
println(new Parser("say \"Zef\" to: out").acceptExp().toIndentedString(0));
println(new Parser("a.b 20 + 8 + 4").acceptExp().toIndentedString(0));
*/
/*
var m = new Map<String, Term>();
println(t.match(matchTerm, m));
println(m);
*/
}
Jump to Line
Something went wrong with that request. Please try again.