--- a/progs/funt.scala Mon Feb 05 10:58:48 2018 +0000
+++ b/progs/funt.scala Thu Apr 05 02:33:30 2018 +0100
@@ -115,8 +115,8 @@
// regular expressions for the While language
-val SYM = RANGE("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_")
-val DIGIT = RANGE("0123456789")
+val SYM = RANGE("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_".toList)
+val DIGIT = RANGE("0123456789".toList)
val ID = SYM ~ (SYM | DIGIT).%
val NUM = PLUS(DIGIT)
val KEYWORD : Rexp = "if" | "then" | "else" | "write" | "def"
@@ -486,3 +486,23 @@
//examples
compile_run("defs.rec")
//compile_run("fact.rec")
+
+
+
+
+
+// a problem with the parser
+val text = "(((((1)))))"
+val tokens = tokenizer(text)
+println(tokens)
+val ast = Prog.parse_single(tokens)
+println(ast)
+
+Exp.parse_single(tokens)
+
+
+
+val text = "((((1))))"
+val tokens = tokenizer(text)
+println(tokens)
+Exp.parse(tokens)