diff -r cc8e231529fb -r 6291181fad07 thys2/zre8.sc --- a/thys2/zre8.sc Tue Jan 25 13:12:50 2022 +0000 +++ b/thys2/zre8.sc Sun Jan 30 23:36:31 2022 +0000 @@ -62,6 +62,16 @@ var pos : Int = 0 + //size: of a Aregx for testing purposes + def size(r: Rexp) : Int = r match { + case ZERO => 1 + case ONE => 1 + case CHAR(_) => 1 + case SEQ(r1, r2) => 1 + size(r1) + size(r2) + case ALT(r1, r2) => 1 + List(r1, r2).map(size).sum + case STAR(r) => 1 + size(r) + } + //input .................. @@ -82,16 +92,16 @@ // c match { // case StarC(m, vs, inside) => vs.length // } - val idx = m.parents.lastIndexWhere(c0 => c0.starIters < c.starIters) - if(m.parents.size == 2){ - println("third parent added") - println(simpleCtxDisplay(c)) - println("the other parents") - m.parents.foreach(c00 => println(c00.starIters)) - println(idx + 1) - println("c's star iters: "+ c.starIters) - println(s"the others' star iters: ${m.parents(0).starIters}") - } + val idx = m.parents.lastIndexWhere(c0 => c0.starIters <= c.starIters) + // if(m.parents.size == 1){ + // println("third parent added") + // println(simpleCtxDisplay(c)) + // println("the other parents") + // m.parents.foreach(c00 => println(c00.starIters)) + // println(idx + 1) + // println("c's star iters: "+ c.starIters) + // println(s"the others' star iters: ${m.parents(0).starIters}") + // } m.parents.insert(idx + 1, c) //m.parents = m.parents:::List(c) m.result.find(endPos_value => endPos_value._1 == pos) match { @@ -461,8 +471,8 @@ for(i <- 1 to 2) { mems.clear() println(s"there are $i number of a's") -val re1 = ("a" | "aa" | "ab").%//(("a" | "b") ~ "c" | ("b" | "e") ~ "c" ) ~ "f" -val re1Lexed = lex(re1, "a"*i) +val re1 = ("a" | "ab" ) ~ ("c" | "bc")//(("a" | "b") ~ "c" | ("b" | "e") ~ "c" ) ~ "f" +val re1Lexed = lex(re1, "abc") //drawZippers(re1Lexed) println("size of actual zipper (including memoized contexts") @@ -480,13 +490,6 @@ } ) - val mb = 1024*1024 -val runtime = Runtime.getRuntime -println("ALL RESULTS IN MB") -println("** Used Memory: " + (runtime.totalMemory - runtime.freeMemory) / mb) -println("** Free Memory: " + runtime.freeMemory / mb) -println("** Total Memory: " + runtime.totalMemory / mb) -println("** Max Memory: " + runtime.maxMemory / mb) }