Skip to content

James-P-D/OCAMLDump

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 

Repository files navigation

OCAMLDump

Dumping ground for OCAML

Most of this taken from running through the Dan Grossman's tutorial from Washington University, the offical OCAML website and from the learn-x-in-y-minutes website.

Learning

(Mostly tested with the online Try OCAML website, but should also work fine with the installed version.)

Rock, Paper Scissors

After a lot of playing around, managed to get Rock, Paper, Scissors working..

Screenshot

Compiling

Compiling instructions taken from RIP Tutorial website.

Note this section makes use of hello.ml

Compiling to Bytecode

Use ocamlc to compile to bytecode:

jdorr@DESKTOP-MF9T345 /cygdrive/c/Users/jdorr/Desktop/Dev/PegSolitaire/src
$ cat hello.ml
let () = print_endline "Hello World!"
jdorr@DESKTOP-MF9T345 /cygdrive/c/Users/jdorr/Desktop/Dev/PegSolitaire/src
$ ocamlc -o hello hello.ml

jdorr@DESKTOP-MF9T345 /cygdrive/c/Users/jdorr/Desktop/Dev/PegSolitaire/src
$ ./hello
Hello World!

Compiling to Native

Use ocamlopt to compile to native:

jdorr@DESKTOP-MF9T345 /cygdrive/c/Users/jdorr/Desktop/Dev/PegSolitaire/src
$ cat hello.ml
jdorr@DESKTOP-MF9T345 /cygdrive/c/Users/jdorr/Desktop/Dev/PegSolitaire/src
$ ocamlopt -o hello hello.ml                                
jdorr@DESKTOP-MF9T345 /cygdrive/c/Users/jdorr/Desktop/Dev/PegSolitaire/src
$ ./hello
Hello World!

Note the resulting executable also runs fine from Windows:

C:\Users\jdorr\Desktop\Dev\PegSolitaire\src>hello.exe
Hello World!

About

Dumping ground for OCAML

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages