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=2.4 required=5.0 tests=AWL,DNS_FROM_RFC_POST, SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 86F3FBBC4 for ; Sun, 8 Mar 2009 00:53:07 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Am4CAOeXsklKfU4YlGdsb2JhbACUYz8BAQEBCQsICREDrUCBB48NAQMBA4QCBoMU X-IronPort-AV: E=Sophos;i="4.38,321,1233529200"; d="scan'208";a="25225059" Received: from ey-out-2122.google.com ([74.125.78.24]) by mail1-smtp-roc.national.inria.fr with ESMTP; 08 Mar 2009 00:53:07 +0100 Received: by ey-out-2122.google.com with SMTP id 9so88653eyd.15 for ; Sat, 07 Mar 2009 15:53:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:references:message-id:from:to :in-reply-to:content-type:content-transfer-encoding:mime-version :subject:date:cc:x-mailer; bh=XqTSQcqoM28elm+2zuJKfelxoDolYgwXOBKQeYjou+M=; b=P0ZnTJQtT+/N1eSLaoDWce5+nZ6PdqpSMAbw3VFRGaR+BQ4EdGtJGxG1EtBRScFqxy Qkf+aDB+wiEZcEotysDmP9kgv+ZccDj0S8zpV8u4+OAXhVeNZaBI2kPJ04pXpyLoi/KK SxzAZn6wQm0co4WNz/rL9tvscxkfziDLnBbUY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=references:message-id:from:to:in-reply-to:content-type :content-transfer-encoding:mime-version:subject:date:cc:x-mailer; b=ELVbJR4fY1u2o1io9TBx+zGm9gd71dZArXU1tHQRMYHJB5fd8Ca0uRxKEZxSGkUuuj v3rrvmuLFPoUlnTzC/9p2sAAAab34cdoMJqRcqLLtsnHYxFuFCaft+5ETEq3pwCXt2aD BsIKdp/jLTo6pDOoh3uTggvr7PmJnKcT3ZZ5Q= Received: by 10.210.76.4 with SMTP id y4mr2301977eba.17.1236469986734; Sat, 07 Mar 2009 15:53:06 -0800 (PST) Received: from ?10.10.30.5? (94.Red-88-6-143.staticIP.rima-tde.net [88.6.143.94]) by mx.google.com with ESMTPS id 5sm2708914eyh.1.2009.03.07.15.53.05 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 07 Mar 2009 15:53:06 -0800 (PST) References: <200903072352.18127.jon@ffconsultancy.com> Message-Id: From: Joel Reymont To: Jon Harrop In-Reply-To: <200903072352.18127.jon@ffconsultancy.com> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v930.3) Subject: Re: [Caml-list] camlp4 stream parser syntax Date: Sat, 7 Mar 2009 23:53:03 +0000 Cc: caml-list@yquem.inria.fr X-Mailer: Apple Mail (2.930.3) X-Spam: no; 0.00; camlp:01 parser:01 syntax:01 parser:01 denotes:01 expr:01 expr:01 camlp:01 grammars:01 matthieu:01 ocaml:01 grammars:01 ocaml:01 token:01 wrote:01 Jon, On Mar 7, 2009, at 11:52 PM, Jon Harrop wrote: > The [< .. >] denote a stream when matching over one using the > "parser" keyword > and the tick ' denotes a kind of literal to identify a single token > in the > stream. So: > > | [< 'Kwd "if"; p=parse_expr; 'Kwd "then"; t=parse_expr; > 'Kwd "else"; f=parse_expr >] -> 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. Do I loose anything when going with camlp4 grammars and NOT parsing into an OCaml AST? Do I gain a lot with grammars over stream parsing? Thanks, Joel --- http://tinyco.de Mac, C++, OCaml