progs/lexer/lex.sc
changeset 846 3a535de22816
parent 844 bbbc2a7940cb
child 852 8706b846a3e0
equal deleted inserted replaced
845:ddd9659971ec 846:3a535de22816
   155 val ID = SYM ~ (SYM | DIGIT).% 
   155 val ID = SYM ~ (SYM | DIGIT).% 
   156 val NUM = PLUS(DIGIT)
   156 val NUM = PLUS(DIGIT)
   157 val KEYWORD : Rexp = "skip" | "while" | "do" | "if" | "then" | "else" | "read" | "write" 
   157 val KEYWORD : Rexp = "skip" | "while" | "do" | "if" | "then" | "else" | "read" | "write" 
   158 val SEMI: Rexp = ";"
   158 val SEMI: Rexp = ";"
   159 val OP: Rexp = ":=" | "=" | "-" | "+" | "*" | "!=" | "<" | ">"
   159 val OP: Rexp = ":=" | "=" | "-" | "+" | "*" | "!=" | "<" | ">"
   160 val WHITESPACE = PLUS(" " | "\n" | "\t")
   160 val WHITESPACE = PLUS(" " | "\n" | "\t" | "\r")
   161 val RPAREN: Rexp = "}"
   161 val RPAREN: Rexp = "}"
   162 val LPAREN: Rexp = "{"
   162 val LPAREN: Rexp = "{"
   163 val STRING: Rexp = "\"" ~ SYM.% ~ "\""
   163 val STRING: Rexp = "\"" ~ SYM.% ~ "\""
   164 
   164 
   165 
   165