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=1.1 required=5.0 tests=AWL,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 64AD3BC6D for ; Mon, 28 Jan 2008 15:35:21 +0100 (CET) X-IronPort-AV: E=Sophos;i="4.25,260,1199660400"; d="scan'208";a="7331765" Received: from peray.inria.fr (HELO ausone.inria.fr) ([128.93.8.98]) by mail1-relais-roc.national.inria.fr with SMTP; 28 Jan 2008 15:35:21 +0100 Received: by ausone.inria.fr (sSMTP sendmail emulation); Mon, _d Jan 2008 15:34:18 +0100 From: "Nicolas Pouillard" Content-Type: text/plain; charset=UTF-8 Cc: caml-list Subject: Re: [Caml-list] camlp4 and quotations for c#: Two parsers needed? To: jon References: <200801281058.19602.jon@ffconsultancy.com> In-Reply-To: <200801281058.19602.jon@ffconsultancy.com> Date: Mon, 28 Jan 2008 15:34:18 +0100 Message-Id: <1201530780-sup-5817@ausone.inria.fr> User-Agent: Sup/git X-Spam: no; 0.00; camlp:01 parsers:01 ocaml:01 camlp:01 parser:01 parser:01 lexer:01 lexer:01 parsers:01 wrote:01 compile:01 caml-list:01 reuse:01 ast:02 quotations:03 Excerpts from jon's message of Mon Jan 28 11:58:19 +0100 2008: > On Monday 28 January 2008 10:59:15 Joel Reymont wrote: > > I would like to introduce statements in C# into my OCaml code and have > > camlp4 convert them to my C# AST at compile time. I would also like to > > reuse the same parser used by camlp4 to parser regular C# files. > > > > Is it possible to share a parser this way or do I need a special > > parser for quotations and another parser to read C# files? > > Camlp4's lexer is undocumented so its utility here is limited. I suspect it > would be easier overall to simply forget all of that and manipulate ML-style > raw ASTs. There is nothing wrong with the Camlp4's *lexer*, it's simple generic and reusable. However I confess that parsers can be a lot more complex. -- Nicolas Pouillard aka Ertai