lean4-htt/tests/lean/run/1089.lean
Leonardo de Moura 4eefc41b6e refactor(*): wrap string in a structure
We want to make sure string users do not depend on the string
implementation. This is the first step.

We need this refactoring *now* to make sure it will not be
super painful to address issue #1175
2017-06-07 17:30:49 -07:00

19 lines
329 B
Text

import system.io
inductive token
| eof : token
| plus : token
| var : string -> token
open token
open option
def to_token : list char → option token
| [] := none
| (c :: cs) :=
let t : option token := match c with
| 'x' := some (var "x")
| 'y' := some (var "y")
| '+' := some plus
| _ := none
end in t