Moved over compiler information printing and error to use stderr, enabled interpreter testing in tester. The interpreter passes 34/74 tests

This commit is contained in:
Nathan Braswell
2016-05-22 14:10:19 -07:00
parent 12dfa837e3
commit ce2eff42a6
9 changed files with 49 additions and 51 deletions

View File

@@ -71,10 +71,8 @@ obj map<T,U> (Object, Serializable) {
fun get(key: T): ref U {
/*return values.get(keys.find(key))*/
var key_loc = keys.find(key)
if (key_loc == -1) {
io::println("trying to access nonexistant key-value!")
while (true) {}
}
if (key_loc == -1)
util::error("trying to access nonexistant key-value!")
return values.get(key_loc)
}
fun get_with_default(key: T, default_val: ref U): ref U {
@@ -85,18 +83,14 @@ obj map<T,U> (Object, Serializable) {
fun reverse_get(value: U): ref T {
/*return values.get(keys.find(key))*/
var value_loc = values.find(value)
if (value_loc == -1) {
io::println("trying to access nonexistant value-key!")
while (true) {}
}
if (value_loc == -1)
util::error("trying to access nonexistant value-key!")
return keys.get(value_loc)
}
fun remove(key: T) {
var idx = keys.find(key)
if (idx < 0) {
io::println("trying to remove nonexistant key-value!")
return;
}
if (idx < 0)
util::error("trying to remove nonexistant key-value!")
keys.remove(idx)
values.remove(idx)
}