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: Nathaniel J. Gaylinn <ngaylinn@c...>
Subject: [Caml-list] parsing OCaml code

I'm trying to figure out a nice way to parse OCaml code in a C++ program. 
All I need is a very basic parse tree for use in syntax highlighting and 
indenting OCaml code.

I would love to make use of some of the programs that already come with 
OCaml. For instance, ocamlc and camlp4 can both output OCaml parse trees 
already! The only problem is the formats that these programs output are 
(to my knowledge) completely undocumented.

If I don't use these programs, I could always try using Lex and Yacc to do 
the job, but I'm completely unfamiliar with these utilities and it would 
take me quite some time to write input for parsing OCaml.

Does anyone know where I could find reference to the various OCaml parse 
tree formats? Does anyone know where I could find Yacc grammar 
descriptions of OCaml, or would I have to write them myself? Does anyone 
have any other suggestions of how to tackle the parsing problem?

Thanks,

   -- Nate Gaylinn