# HG changeset patch # User Christian Urban # Date 1522892010 -3600 # Node ID 48883ea255daeee8a73e367c32446056a70af50c # Parent 36f937b4267500b4c50dd2c7722956142ac83215 updated diff -r 36f937b42675 -r 48883ea255da 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)