equal
deleted
inserted
replaced
1 // A simple lexer inspired by work of Sulzmann & Lu |
1 // A simple lexer inspired by work of Sulzmann & Lu |
2 //================================================== |
2 //================================================== |
3 // |
3 // |
|
4 // call with |
|
5 // |
|
6 // amm lex.sc |
|
7 // |
|
8 |
4 |
9 |
5 // regular expressions including records |
10 // regular expressions including records |
6 abstract class Rexp |
11 abstract class Rexp |
7 case object ZERO extends Rexp |
12 case object ZERO extends Rexp |
8 case object ONE extends Rexp |
13 case object ONE extends Rexp |
174 ("w" $ WHITESPACE)).% |
179 ("w" $ WHITESPACE)).% |
175 |
180 |
176 // Two Simple While Tests |
181 // Two Simple While Tests |
177 //======================== |
182 //======================== |
178 |
183 |
179 @doc("small tests") |
184 @arg(doc = "small tests") |
180 @main |
185 @main |
181 def small() = { |
186 def small() = { |
182 |
187 |
183 val prog0 = """if""" |
188 val prog0 = """if""" |
184 println(s"test: $prog0") |
189 println(s"test: $prog0") |
191 val prog2 = """read n; write n""" |
196 val prog2 = """read n; write n""" |
192 println(s"test: $prog2") |
197 println(s"test: $prog2") |
193 println(lexing(WHILE_REGS, prog2)) |
198 println(lexing(WHILE_REGS, prog2)) |
194 } |
199 } |
195 |
200 |
|
201 |
|
202 |
|
203 |
|
204 |
|
205 // runs with amm2 and amm3 |