
Ask HN: Write a C compiler in Ocaml? - remyb
I have completed an internship in a research lab
in the compilation field, specifically in program
analysis for embedded systems and I&#x27;ve always been fascinated by compilers.<p>After writing a basic C parser in Objective Caml and since I&#x27;m fairly comfortable in C and low-level programming, I&#x27;m asking : what do you think of writing a C compiler in Ocaml or C, given the main goals : fun, getting experience in compiler writing, and maybe bootstrapping (maybe not directly).<p>However, I am not crazy enough to believe that I will be able to support the whole language or compile any non-trivial program in a short term, I am talking more about a long term experiment.<p>Note : It would be based on Lex &#x2F; Yacc.
======
jonjacky
"A tiny C compiler ... in a restricted dialect of OCaml":

[http://c9x.me/qcc/](http://c9x.me/qcc/)

------
edwintorok
There is also Compcert written in Coq and extracted to OCaml:
[http://compcert.inria.fr/](http://compcert.inria.fr/)

