(* main2.rml *)
module Main:
  relation main: string list => ()
end

with "parse.rml"
with "static.rml"

relation parse =
  rule	Parse.parse file => decs
	----------------
	parse file => decs

  rule	not Parse.parse file => _ & print "parsing failed\n"
	----------------
	parse file => fail
end

relation elaborate =
  rule	Static.elaborate(statenv, dec) => statenv'
	----------------
	elaborate(statenv, dec) => statenv'

  rule	not Static.elaborate(statenv, dec) => _ &
	print "type checking failed\n"
	----------------
	elaborate(statenv, dec) => fail
end

relation doall =
  axiom	doall([], _)

  rule	elaborate(statenv, dec) => statenv' & doall(decs, statenv')
	----------------
	doall(dec::decs, statenv)
end

relation main =
  rule	parse file => decs & doall(decs, Static.env0)
	----------------
	main file::_
end
