OCaml
プログラミング言語
https://gyazo.com/f769cbd6a98b602e00e69782b13e262c
opam で環境を切る
$ opam switch install <alias> --alias-of <version>
CS 4100: INTRODUCTION TO FORMAL LANGUAGES AND COMPILERS
OCaml で言語処理系を作る講義資料
Dune(jbuilder)
トップレベルの設定を stanza (節?) と呼ぶ
(executable ((name main) (libraries()))
excutable stanza で実行可能ファイルについての設定
name はエントリポイントが記述されたファイル名を指定(この場合 main.ml)
jbuilder build ???.exe でビルド
??? は excutable で指定した名前 → 今回なら main.exe とする
.exe は Dune が実行ファイルを参照するためのルール
.exe は Windows/macOS/Linux 関係なく指定
jbuilder exec main.exe で起動
exec は暗黙的に build も実行するので、しょっぱなから exec でビルド&起動できる。
jbuilder utop <dir> で utop 起動
OCaml の拡張子
table:OCamlの拡張子
目的 C言語 バイトコード ネイティブコード
ソースファイル *.c *.ml *.ml
ヘッダファイル *.h *.mli *.mli
オブジェクトファイル *.o *.cmo *.cmx
ライブラリ *.a *.cma *.cmxa
実行バイナリ prog prog prog.opt
*.cmi は *.mli のコンパイル後の中間表現
ocamlc -c foo.mli
OCaml で書かれた言語
https://github.com/0x0f0f0f/gobba
OCaml で UNIXシステムプログラミング
https://ocaml.github.io/ocamlunix/index.html
dypgen: Self-extensible parsers and lexers for OCaml
GRL法のパーサーなので menhir より表現範囲が広い?
http://dypgen.free.fr/
Why ML/OCaml are good for writing compilers
http://flint.cs.yale.edu/cs421/case-for-ml.html
A WebAssembly backend for OCaml
https://medium.com/@sanderspies/a-webassembly-backend-for-ocaml-b78e7eeea9d5
Objects use cases in OCaml
https://discuss.ocaml.org/t/objects-use-cases-in-ocaml/2282
Async と Lwt の違い
http://rgrinberg.com/posts/abandoning-async/
camlspotterさんが勉強になると言ったソース
https://github.com/ocaml/dune/blob/master/src/fiber/fiber.ml
Js_of_ocaml vs BuckleScript
https://discuss.ocaml.org/t/js-of-ocaml-vs-bucklescript/2293
#programming