All Projects → clarus → Coq Of Ocaml

clarus / Coq Of Ocaml

Licence: mit
Import OCaml programs to Coq 🐓 🐫

Programming Languages

ocaml
1615 projects

Projects that are alternatives of or similar to Coq Of Ocaml

Certicoq
A Verified Compiler for Gallina, Written in Gallina
Stars: ✭ 66 (-43.59%)
Mutual labels:  compiler, coq
Compcert
The CompCert formally-verified C compiler
Stars: ✭ 984 (+741.03%)
Mutual labels:  compiler, coq
Awesome Provable
A curated set of links to formal methods involving provable code.
Stars: ✭ 111 (-5.13%)
Mutual labels:  coq
Chirp
A modern low-level programming language
Stars: ✭ 116 (-0.85%)
Mutual labels:  compiler
Ccompiler
c语言编译器,用 lex 和 yacc 工具完成词法分析与语法分析并生成语法树,C++实现了语 法树的解析并生成中间代码,生成中间代码的过程中实现了错误检测。C++实 现了中间代码的优化操作。之后利用 python 对中间代码进行处理并生成 mips 汇编码并且可以成功在 PCSpim(mips 模拟器)上运行。
Stars: ✭ 113 (-3.42%)
Mutual labels:  compiler
Fathom
🚧 (Alpha stage software) A declarative data definition language for formally specifying binary data formats. 🚧
Stars: ✭ 111 (-5.13%)
Mutual labels:  compiler
Crossshader
⚔️ A tool for cross compiling shaders. Convert between GLSL, HLSL, Metal Shader Language, or older versions of GLSL.
Stars: ✭ 113 (-3.42%)
Mutual labels:  compiler
Impatient
Ain't nobody got time for data
Stars: ✭ 110 (-5.98%)
Mutual labels:  compiler
Shadow Rs
A build-time information stored in your rust project.(binary,lib,cdylib,dylib)
Stars: ✭ 117 (+0%)
Mutual labels:  compiler
Hikari
LLVM Obfuscator
Stars: ✭ 1,585 (+1254.7%)
Mutual labels:  compiler
Rucc
rucc is a tiny toy C compiler in Rust.
Stars: ✭ 115 (-1.71%)
Mutual labels:  compiler
Flax
general purpose programming language, in the vein of C++
Stars: ✭ 111 (-5.13%)
Mutual labels:  compiler
Kou
A minimal language compiled into wasm bytecode
Stars: ✭ 112 (-4.27%)
Mutual labels:  compiler
Iron
Coq formalizations of functional languages.
Stars: ✭ 114 (-2.56%)
Mutual labels:  coq
Godzilla
Godzilla is a ES2015 to Go source code transpiler and runtime
Stars: ✭ 1,464 (+1151.28%)
Mutual labels:  compiler
Gopherjs
A compiler from Go to JavaScript for running Go code in a browser
Stars: ✭ 10,721 (+9063.25%)
Mutual labels:  compiler
Futhark
💥💻💥 A data-parallel functional programming language
Stars: ✭ 1,641 (+1302.56%)
Mutual labels:  compiler
Brain
An esoteric programming language compiler on top of LLVM based on Brainfuck
Stars: ✭ 112 (-4.27%)
Mutual labels:  compiler
Elixirscript
Converts Elixir to JavaScript
Stars: ✭ 1,504 (+1185.47%)
Mutual labels:  compiler
Peachpy
x86-64 assembler embedded in Python
Stars: ✭ 1,592 (+1260.68%)
Mutual labels:  compiler

Logo coq-of-ocaml

Import OCaml programs to Coq.

CI

https://clarus.github.io/coq-of-ocaml/

Start with the file main.ml:

type 'a tree =
  | Leaf of 'a
  | Node of 'a tree * 'a tree

let rec sum tree =
  match tree with
  | Leaf n -> n
  | Node (tree1, tree2) -> sum tree1 + sum tree2

Run:

coq-of-ocaml main.ml

Get a file Main.v:

Require Import CoqOfOCaml.CoqOfOCaml.
Require Import CoqOfOCaml.Settings.

Inductive tree (a : Set) : Set :=
| Leaf : a -> tree a
| Node : tree a -> tree a -> tree a.

Arguments Leaf {_}.
Arguments Node {_}.

Fixpoint sum (tree : tree int) : int :=
  match tree with
  | Leaf n => n
  | Node tree1 tree2 => Z.add (sum tree1) (sum tree2)
  end.

Features

  • core of OCaml (functions, let bindings, pattern-matching,...) ✔️
  • type definitions (records, inductive types, synonyms, mutual types) ✔️
  • modules as namespaces ✔️
  • modules as dependent records (signatures, functors, first-class modules) ✔️
  • projects with complex dependencies using .merlin files ✔️
  • .ml and .mli files ✔️
  • existential types ✔️
  • partial support of GADTs 🌊
  • partial support of polymorphic variants 🌊
  • partial support of extensible types 🌊
  • ignores side-effects ❌

Even in case of errors we try to generate some Coq code. The generated Coq code should be readable and with a size similar to the OCaml source. One should not hesitate to fix remaining compilation errors, by hand or with a script (name collisions, missing Require,...).

Install

Latest stable version

Using the package manager opam,

opam install coq-of-ocaml

Current development version

To install the current development version:

opam pin add https://github.com/clarus/coq-of-ocaml.git#master

Manually

Read the coq-of-ocaml.opam file at the root of the project to know the dependencies to install and get the list of commands to build the project.

Usage

coq-of-ocaml compiles the .ml or .mli files using Merlin to understand the dependencies of a project. One first needs to have a compiled project with a working configuration of Merlin. The basic command is:

coq-of-ocaml file.ml

If this does not work as expected, you may specify the path to a .merlin file:

coq-of-ocaml -merlin src/.merlin path/file.ml

You can start to experiment with the test files in tests/ or look at our online examples.

License

MIT © Guillaume Claret.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].