From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 9A7BFBBC4 for ; Sun, 8 Mar 2009 01:07:16 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AmIBAGubsknUnwcjjmdsb2JhbACCHZMFAQEBAQkLCAkPBr1bhAUG X-IronPort-AV: E=Sophos;i="4.38,321,1233529200"; d="scan'208";a="24005187" Received: from relay.ptn-ipout01.plus.net ([212.159.7.35]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 08 Mar 2009 01:06:42 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvIEAD+asknUnw4U/2dsb2JhbACCHdERhAUG Received: from pih-relay08.plus.net ([212.159.14.20]) by relay.ptn-ipout01.plus.net with ESMTP; 08 Mar 2009 00:06:41 +0000 Received: from [87.112.234.120] (helo=leper.local) by pih-relay08.plus.net with esmtp (Exim) id 1Lg6XR-0005wP-88; Sun, 08 Mar 2009 00:06:41 +0000 From: Jon Harrop Organization: Flying Frog Consultancy Ltd. To: Joel Reymont , caml-list@yquem.inria.fr Subject: Re: [Caml-list] camlp4 stream parser syntax Date: Sun, 8 Mar 2009 00:12:10 +0000 User-Agent: KMail/1.9.9 References: <200903072352.18127.jon@ffconsultancy.com> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200903080012.10433.jon@ffconsultancy.com> X-Plusnet-Relay: 06670b10b448d6920e69fac0155e53de X-Spam: no; 0.00; camlp:01 parser:01 syntax:01 camlp:01 grammars:01 matthieu:01 ocaml:01 parsers:01 grammars:01 ocaml:01 syntax:01 lexer:01 2009:98 frog:98 imho:01 On Saturday 07 March 2009 23:53:03 you wrote: > Should I be using camlp4 grammars as Matthieu suggested? > > It seems there are are far more and better resources on doing this > than the stream parsing approach. This includes your OCaml Journal. I would say that there is very little documentation about either approach but I personally found it much easier to use the stream parsers rather than camlp4 because they are much simpler and, therefore, do not require so much documentation. Having said that, I never used ??. > Do I loose anything when going with camlp4 grammars and NOT parsing > into an OCaml AST? No, parsing into other ASTs is really easy with Camlp4. > Do I gain a lot with grammars over stream parsing? Swings and roundabouts, IMHO. Camlp4 is higher level, more capable and the syntax is clearer but the documentation is so poor that I have given up every time I have tried to use it either because the default lexer was insufficient or because I could not figure out how to extract the necessary data from the OCaml grammar. Matthieu's example looks fantastic though... -- Dr Jon Harrop, Flying Frog Consultancy Ltd. http://www.ffconsultancy.com/?e