caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] parsing included files recursively using ocamllex and ocamlyacc
@ 2003-09-20 14:38 Benjamin Geer
  2003-09-20 15:15 ` Michal Moskal
  2003-09-22  8:41 ` Hendrik Tews
  0 siblings, 2 replies; 5+ messages in thread
From: Benjamin Geer @ 2003-09-20 14:38 UTC (permalink / raw)
  To: caml-list

I'm writing an interpreter for a small language (to be released as an 
open source library), using ocamllex and ocamlyacc.  I'd like this 
language to support an instruction that, at compile time, recursively 
includes source code from another file.

I searched the list archives and found a message 
(http://pauillac.inria.fr/caml/caml-list/0258.html), posted here in 1997 
by Xavier Leroy, which suggests one way to write a recursive 
"yacc_start" function.  However, the details of this approach aren't 
clear to me; could someone provide a more detailed explanation of what 
would be involved (e.g. a brief outline of the contents of this 
function)?  What about ocamllex?  Would I have to save the lexbuf on a 
stack, and restore it after each recursive call?

I considered using (or writing) a preprocessor to do the includes, but I 
couldn't think of a way to do this without losing the ability to report 
filenames and line numbers in run-time error messages.

Ben


-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-09-22  8:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-20 14:38 [Caml-list] parsing included files recursively using ocamllex and ocamlyacc Benjamin Geer
2003-09-20 15:15 ` Michal Moskal
2003-09-20 19:07   ` Benjamin Geer
2003-09-22  7:22     ` Eckart Goehler
2003-09-22  8:41 ` Hendrik Tews

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).