lean4-htt/tests/ir/lirc.lean
2018-05-15 12:09:04 -07:00

13 lines
434 B
Text

import system.io
import init.lean.ir.lirc
open lean.ir io
def main : io unit :=
do args ← io.cmdline_args,
unless (args.length = 1) $
io.fail "Error: incorrect number of arguments, expected `lirc file.lean`",
let fname := args.head,
input ← fs.read_file fname,
match lirc input {main_proc := some "main"} with
| except.ok r := fs.write_file (fname ++ ".cpp") r
| except.error e := io.fail (to_string e)