# HG changeset patch # User Christian Urban # Date 1522892010 -3600 # Node ID c6ba1d17aaf3220183c1767e2cbba218a192d475 # Parent 81eb43c4141612f76511346551e8804ab90cdfa1 updated diff -r 81eb43c41416 -r c6ba1d17aaf3 progs/funt.scala --- 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)