Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] parsing OCaml code
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Eric Cooper <ecc@c...>
Subject: Re: [Caml-list] parsing OCaml code
On Tue, Jul 19, 2005 at 01:05:58PM -0400, Nathaniel J. Gaylinn wrote:
> Does anyone know where I could find Yacc grammar descriptions of
> OCaml, or would I have to write them myself?

OCaml uses ocamlyacc and ocamllex for its front-end: see
.../parsing/parser.mly and lexer.mll.

ocamlyacc is very similar to yacc/bison; reuse of the grammar should
be straightforward.

ocamllex is similar to lex/flex, but it supports mutually recursive
rules instead of lex's explicit "start conditions", so you might have
a bit more work if you want to translate it.

-- 
Eric Cooper             e c c @ c m u . e d u