English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

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: 2005-07-19 (17:06)
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?


   -- Nate Gaylinn