New Language - Interfacing with AVR
I have no experience with OCaml or with writing compilers, but I would
suggest that you first learn how to program the Arduino, then teach
your compiler to do so.

You may start by using the Arduino IDE and a couple basic tutorials.
There is an option in the IDE for displaying all the commands it runs to
get your program compiled and linked. Take note of these commands, then
throw the IDE away. Alternatively, you can download one of the few
Arduino Makefiles that float around the Web.

You will see that the basic toolset you need is the following:


The AVR flavor of GNU GCC and the binutils. This allows you to program
the AVR in assembly, C and C++. Calling these tools from your own
compiler should be as easy as calling them from the command-line.
The avr-libc, which is a port of
the libc for the AVR, together with some AVR-specific stuff, and the C
runtime. It does not provide a hardware abstraction layer.
The Arduino core library, a beginner-oriented C++ library built on top
of avr-libc. It does provide a hardware abstraction layer and is
source-level compatible with non-AVR based Arduinos.


In terms of language and API, your main choices are: AVR assembly, C +
avr-libc, C++ + avr-libc, C++ + Arduino core + avr-libc. There are
others, of course, these are just the better known. Pick your favorite,
learn how to use it, then teach your compiler.