Fixed the parse bug. I think it's legal for the post-shift table check to be invalid and you have to account for that in the table

This commit is contained in:
Nathan Braswell
2015-12-26 01:52:29 +00:00
parent 5476289b51
commit 22b334a2ae
5 changed files with 18 additions and 6 deletions

View File

@@ -598,7 +598,9 @@ obj table (Object, Serializable) {
} }
fun get(state: int, on_symbol: symbol::symbol): vector::vector<action> { fun get(state: int, on_symbol: symbol::symbol): vector::vector<action> {
var cleaned_symbol = clean_symbol(on_symbol) var cleaned_symbol = clean_symbol(on_symbol)
if (items[state].contains_key(cleaned_symbol))
return items[state][cleaned_symbol] return items[state][cleaned_symbol]
return vector::vector<action>()
} }
fun get_shift(state: int, on_symbol: symbol::symbol): action { fun get_shift(state: int, on_symbol: symbol::symbol): action {
var actions = get(state, on_symbol) var actions = get(state, on_symbol)

View File

@@ -65,7 +65,7 @@ obj map<T,U> (Object, Serializable) {
var key_loc = keys.find(key) var key_loc = keys.find(key)
if (key_loc == -1) { if (key_loc == -1) {
io::println("trying to access nonexistant key-value!") io::println("trying to access nonexistant key-value!")
/*while (true) {}*/ while (true) {}
} }
return values.get(key_loc) return values.get(key_loc)
} }

View File

@@ -12,8 +12,8 @@ fun main():int {
var a.construct(): grammer var a.construct(): grammer
/*var file_name = string("../krakenGrammer.kgm")*/ var file_name = string("../krakenGrammer.kgm")
var file_name = string("../simplifiedKrakenGrammer.kgm") /*var file_name = string("../simplifiedKrakenGrammer.kgm")*/
/*var file_name = string("grammer.kgm")*/ /*var file_name = string("grammer.kgm")*/
var compiled_name = file_name + string(".comp_new") var compiled_name = file_name + string(".comp_new")

5
tests/to_import.krak Normal file
View File

@@ -0,0 +1,5 @@
var a = 1

View File

@@ -1 +1,6 @@
why {} import to_import
fun main(): int {
return 0
}