lean4-htt/tests/ir/lirc.lean
Leonardo de Moura b0a4066695 test(tests/ir): add basic script for compiling IR definitions
The support libraries are currently hard coded.
2018-05-14 17:27:05 -07:00

13 lines
407 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 with
| except.ok r := fs.write_file (fname ++ ".cpp") r
| except.error e := io.fail (to_string e)