Move away from fully_reduces_to_null to rule_position, fixed some bugs. Have not fixed all, still looks up unkown key-value for the full kraken parse test.

This commit is contained in:
Nathan Braswell
2015-08-13 01:48:35 -04:00
parent 4b6693ac1c
commit 6a62f03fb4
7 changed files with 52 additions and 13 deletions

View File

@@ -7,8 +7,10 @@ c = "a" | d ;
d = e post_null post_non_null inherit_null ;
inherit_null = e | post_non_null ;
e = ;
e = f | ;
e = g ;
#e = e | g ;
f = ;
g = f ;
post_null = "hi" ;
post_non_null = "bye" ;
rec = "hmm" rec | ;

5
tests/grammer4.kgm Normal file
View File

@@ -0,0 +1,5 @@
# comment
Goal = a ;
a = "a" d ;
d = g ;
g = ;

View File

@@ -13,6 +13,7 @@ fun main():int {
/*var a = load_grammer(read_file(string("grammer.kgm")))*/
/*var a = load_grammer(read_file(string("grammer2.kgm")))*/
/*var a = load_grammer(read_file(string("grammer3.kgm")))*/
/*var a = load_grammer(read_file(string("grammer4.kgm")))*/
println(a.to_string())
var doFirstSet = fun() {
a.calculate_first_set()
@@ -52,6 +53,7 @@ fun main():int {
println(a.to_string())
a.calculate_state_automaton()
var parse.construct(a): parser
/*var result = parse.parse_input(string("a"), string("fun name"))*/
var result = parse.parse_input(read_file(string("to_parse.krak")), string("fun name"))
/*var result = parse.parse_input(string("inport a;"), string("fun name"))*/
/*var result = parse.parse_input(string("fun main():int { return 0; }"), string("fun name"))*/