Version française
Home     About     Download     Resources     Contact us    
Browse thread
Handling include files using ocamllex
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Christoph Bauer <Christoph.Bauer@l...>
Subject: RE: [SPAM?][Caml-list] Handling include files using ocamllex
> Hi all,
> 
> I doing some simple parsing with ocamllex and ocamlyacc and I 
> need to be able to handle C style include files.
> 
> I know how to do this in C with flex and bison, but I can't 
> figure out how to do it with ocamllex and ocamlyacc.
> 
> Anyone know how to do this?

A solution could be to create an lexbuf from a function with
Lexing.from_function.
This function has to manage a stack of open channels and positions. It
has to 
scan for "#include"-statements and copies instead of these statements
the contents
of the corresponding files into the buffer.

Just an idea, I haven't done it yet.

Christoph Bauer