caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Two quick questions.
@ 2001-07-02  7:36 Jeremy Fincher
  2001-07-02  8:03 ` Chris Hecker
  2001-07-02 11:53 ` wakita
  0 siblings, 2 replies; 3+ messages in thread
From: Jeremy Fincher @ 2001-07-02  7:36 UTC (permalink / raw)
  To: caml-list

First: I looked at the source code to the Printf module to see exactly how 
Printf.printf does type checking on the format strings, since I'd like to 
implement something similar (for reimplementing the "struct" python module, 
which uses format strings to pack/unpack arbitrary binary data) but I 
honestly had no idea how it worked.  Is something like what Printf.printf 
does way too "deep magic" for a newbie to O'Caml to do, or are there any 
good explanations of how it does what it does?

Second: Are there any good examples of using ocamllex/ocamlyacc to build 
abstract syntax trees?  I've seen ASTs built from streams in the Caml-light 
manual, and I've seen examples of ocamllex/ocamlyacc used to parse simple 
languages that don't really need an AST, but I can't find any examples (with 
explanations, of course :)) of ocamllex/ocamlyacc being used to actually 
create abstract syntax trees for a given grammar.

Thanks,
Jeremy
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com

-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


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

* Re: [Caml-list] Two quick questions.
  2001-07-02  7:36 [Caml-list] Two quick questions Jeremy Fincher
@ 2001-07-02  8:03 ` Chris Hecker
  2001-07-02 11:53 ` wakita
  1 sibling, 0 replies; 3+ messages in thread
From: Chris Hecker @ 2001-07-02  8:03 UTC (permalink / raw)
  To: Jeremy Fincher, caml-list


>First: I looked at the source code to the Printf module to see exactly how Printf.printf does type checking on the format strings, since I'd like to implement something similar (for reimplementing the "struct" python module, which uses format strings to pack/unpack arbitrary binary data) but I honestly had no idea how it worked.  Is something like what Printf.printf does way too "deep magic" for a newbie to O'Caml to do, or are there any good explanations of how it does what it does?

It is "deep magic", in the sense that it's hacked into the compiler directly.  You can use some of the hacks for your own purposes, but you can't change the format string format.

Chris


-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


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

* Re: [Caml-list] Two quick questions.
  2001-07-02  7:36 [Caml-list] Two quick questions Jeremy Fincher
  2001-07-02  8:03 ` Chris Hecker
@ 2001-07-02 11:53 ` wakita
  1 sibling, 0 replies; 3+ messages in thread
From: wakita @ 2001-07-02 11:53 UTC (permalink / raw)
  To: caml-list


You might be interested in "Functional unparsing" by Olivier Danvy.

http://www.brics.dk/RS/98/12/
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


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

end of thread, other threads:[~2001-07-02 11:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-02  7:36 [Caml-list] Two quick questions Jeremy Fincher
2001-07-02  8:03 ` Chris Hecker
2001-07-02 11:53 ` wakita

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).