[LLVMdev] LLVM OCaml Tutorial

Chris Wailes chris.wailes at gmail.com
Wed Apr 22 04:15:09 PDT 2009


>
> I'm happy to apply any patches :) Even better if you wanted to extend
> the tutorial to support things like garbage collection.


As I go along in my project and explore these features I might be willing to
produce code for additional chapters but I don't think I have time to
dedicate to it now.

What was the problem? I just tested it out on fedora 10 and it worked
> after I installed the ocaml, ocaml-camlp4, and ocaml-camlp4-devel
> rpms.
>

When I tried it the pre-processor executable had not been created and
installed.  When the compiler tried to pass it through, it couldn't find
anything.  It has been a little bit since I tried, and there may have been
updates, so the issue may have been fixed.

Well you still run into that with ocamllex/ocamlyacc :) Maybe I'm just
> used to the stream syntax extension, but I figured it was fair game
> since it's part of the standard install. It's not my fault the fedora
> project decided to make it not part of the standard ocaml install :)


That is perfectly understandable.  My problem was that I had never seen the
stream syntax before.  While I'm no OCaml master, I have used it for a while
and so it might be that other people coming to the tutorial may have the
same experience.  Secondly, it seems odd to be writing custom parsers and
lexers after tools like Bison and Flex (and ocamllex and ocamlyacc) have
been around for some time.  Is there any particular reason the C++ tutorial
is using  hand coded parsers and lexers?  Is there a technical reason?

- Chris Wailes

On Tue, Apr 21, 2009 at 3:46 PM, Erick Tryzelaar <
idadesub at users.sourceforge.net> wrote:

> 2009/4/13 Chris Wailes <chris.wailes at gmail.com>:
> > I'm currently going through the LLVM OCaml bindings tutorial in
> preparation
> > for using LLVM in my own project.  While the tutorial is very helpful, it
> > was somewhat hard to start due to the fact that I plan on using ocamllex
> and
> > ocmalyacc and the tutorial hand rolls their own lexer and parser.
> >
> > I have managed to adapt almost all of the tutorial code into using
> ocamllex
> > and ocamlyacc (the only thing I'm missing is the ability to assign
> > precendence to user defined binary and unary operators), and was
> wondering
> > if ther would be an interest in adding my code as supplimental material.
>
> Great! I'd be happy to add this, though I think as as an addendum
> instead of a replacement unless the community feels strongly about it.
> Since most of the llvm documentation is for c++, I wanted the ocaml
> developers to be able to read the ocaml tutorial then the c++ tutorial
> and it be nearly one-to-one. I thought camlp4 did a much better job of
> matching the c++ tutorial than ocamllex/ocamlyacc. That said, a lot of
> people use them and it'd be handy to see how to use them with llvm as
> well.
>
>
> On Sat, Apr 18, 2009 at 11:02 AM, Jon Harrop <jon at ffconsultancy.com>
> wrote:
> > You may also want to write an even smaller parser using camlp4...
>
> I'm happy to apply any patches :) Even better if you wanted to extend
> the tutorial to support things like garbage collection.
>
>
> 2009/4/19 Chris Wailes <chris.wailes at gmail.com>:
> > I would consider doing this, but one of the main reasons I couldn't use
> the
> > main tutorial was because the Fedora 10 camlp4 package was messed up and
> the
> > pre processors weren't linked correctly (I don't think Fedora likes OCaml
> > much).
>
> What was the problem? I just tested it out on fedora 10 and it worked
> after I installed the ocaml, ocaml-camlp4, and ocaml-camlp4-devel
> rpms.
>
> > Anyway, I think it might be best to not include camlp4 macros in the
> > parser, simply to reduce the number of tools that someone needs to know
> to
> > understand the files.  If they know camlp4 they can always add support
> for
> > it in their own projects or as an exercise in understanding the tutorial
> > code.
>
> Well you still run into that with ocamllex/ocamlyacc :) Maybe I'm just
> used to the stream syntax extension, but I figured it was fair game
> since it's part of the standard install. It's not my fault the fedora
> project decided to make it not part of the standard ocaml install :)
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090422/8b698510/attachment.html>


More information about the llvm-dev mailing list