# HG changeset patch # User Christian Urban # Date 1488673864 0 # Node ID 02fd56e2019e806f486bad451f7c5ebc01eb0b66 # Parent 80e7a94f6670a69f202f4934a98fd76c76cb1100 updated the re-ext-scala file diff -r 80e7a94f6670 -r 02fd56e2019e progs/scala/re-ext.scala --- a/progs/scala/re-ext.scala Sat Mar 04 22:27:09 2017 +0000 +++ b/progs/scala/re-ext.scala Sun Mar 05 00:31:04 2017 +0000 @@ -249,15 +249,14 @@ // Lexing Rules -def PLUSs(r: Rexp) = r ~ r.% -val SYM = "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z" -val DIGIT = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" +val SYM = CHARS ("abcdefghijklmnopqrstuvwxyz" contains _) +val DIGIT = CHARS("0123456789" contains _) val ID = SYM ~ (SYM | DIGIT).% -val NUM = PLUSs(DIGIT) +val NUM = PLUS(DIGIT) val KEYWORD : Rexp = "skip" | "while" | "do" | "if" | "then" | "else" | "read" | "write" | "true" | "false" val SEMI: Rexp = ";" val OP: Rexp = ":=" | "==" | "-" | "+" | "*" | "!=" | "<" | ">" | "<=" | ">=" | "%" | "/" -val WHITESPACE = PLUSs(" " | "\n" | "\t") +val WHITESPACE = PLUS(" " | "\n" | "\t") val RPAREN: Rexp = ")" val LPAREN: Rexp = "(" val BEGIN: Rexp = "{" @@ -336,12 +335,12 @@ println("prog3 test - tokens") println(env(lexing_simp(WHILE_REGS, prog3))) -/* -for (i <- 1 to 80) { - print(i.toString + ": ") - time(lexing_simp(WHILE_REGS, prog2 * i)) +println("prog2 replicated test") + +for (i <- 1 to 88) { + println(i + ": " + "%.5f".format(time_needed(2, lexing_simp(WHILE_REGS, prog2 * i)))) } -*/ + // Sulzmann's tests //==================