A tool that translates SML code to Coq
$ git clone --recurse-submodules https://github.com/meta-logic/sml-to-coq.git
Since most SML programs will make use of some part of SML's basis library
, we have implemented Coq equivalents to them.
To compile the Coq Basis Library:
coqBasisLib/libs
$ make
At the top level directory, run:
$ sml -m sources.cm
The main function for generating the Coq code is Generator.generate()
in generator.sml
. It generates a .v
file from the passed .sml
file.
generate(inputFile, outputFile): string * string -> unit
Generator.generate("smlCode.sml", "gallinaCode.v");
Generates the file galllinaCode.v
from the file smlCode.sml
. The file galllinaCode.v
will be located at the top level directory.
To run gallinaCode.v
using coqide:
coqBasisLib/libs
$ coqide
gallinaCode.v
The main function for translating SML code is Convertor.convert()
in convertor.sml
. It takes as a parameter a .sml
file path to the SML program to be translated, and returns the corresponding Gallina AST.
Convertor.convert(inputFile): string -> Gallina.sentence list
Convertor.convert("smlCode.sml"):
Returns Gallina's AST of the sml code in smlCode.sml
, and also it prints it.