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 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id A51F0BC6E for ; Wed, 9 Jan 2008 23:19:00 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAObWhEfAXQInh2dsb2JhbACQHQEBAQgKKZI7hl0 X-IronPort-AV: E=Sophos;i="4.24,264,1196636400"; d="scan'208";a="21069979" Received: from concorde.inria.fr ([192.93.2.39]) by mail4-smtp-sop.national.inria.fr with ESMTP; 09 Jan 2008 23:19:00 +0100 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id m09MIx4F015786 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Wed, 9 Jan 2008 23:19:00 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAObWhEdC+VLmmGdsb2JhbACQHQEBAQEHBAQrkjuGXQ X-IronPort-AV: E=Sophos;i="4.24,264,1196636400"; d="scan'208";a="5885909" Received: from wx-out-0506.google.com ([66.249.82.230]) by mail2-smtp-roc.national.inria.fr with ESMTP; 09 Jan 2008 23:18:59 +0100 Received: by wx-out-0506.google.com with SMTP id h28so343125wxd.0 for ; Wed, 09 Jan 2008 14:18:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; bh=gJY+jCUSNqaCvw30K9btdqmUgSLHx3R53pycXBWjUsY=; b=Yxrta+caEOqX8j3RAGauJ1xdlesIW9rbLWlj2U2NiD/Es35mbgG+cexjR9k/ghnxAMG6oGG2REw7+YXAolHv2ne9HV4+gzi/HPsTZwJ96iSIsvCJmv24ayp/1F5PRjx4Gn0AaIkWsod8C7k7QaYvJIZ8i4tK398TpyZrID9pLeI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=a0acukYMchjW8F+tjDQQcbcSDleVadsIA/UK/nFuX4qxL9h0fUuSgZxye9WoFTkIPyQ5DyeXbqClbUBkN6h1RAj//BixgOtIYiQf3MrSzu0NwZGepIASSDBF3bUjlJXdVa9QvIKEIgRlE7VQYoQykawAfdwaFSzjO73i2+P8V9M= Received: by 10.142.107.1 with SMTP id f1mr658910wfc.77.1199917137484; Wed, 09 Jan 2008 14:18:57 -0800 (PST) Received: by 10.142.98.15 with HTTP; Wed, 9 Jan 2008 14:18:57 -0800 (PST) Message-ID: <9d3ec8300801091418j37e72687v892bcc2b33dc83b4@mail.gmail.com> Date: Wed, 9 Jan 2008 22:18:57 +0000 From: "Till Varoquaux" To: ocaml Subject: Dynamically switching lexer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Miltered: at concorde with ID 47854854.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; lexer:01 camlp:01 lexer:01 ocaml:01 parser:01 expr:01 syntax:01 expr:01 lexers:01 cheers:01 dynamically:01 strings:01 strings:01 parse:02 string:02 I'm currently doing a toy DSEL, Camlp4 pops to mind as a very nice way to embed it unfortunately the standard lexer it comes with is not all that great for my language. Although I do know how to use another lexer it comes with a catch: antiquotation need to be properly lexed to string to be passed to the standard ocaml parser as strings (I use let expr_of_string = Gram.parse_string Syntax.expr_eoi this seems simpler than what is shown in tutorials. Am I missing something?) off course the easy way to delimit such strings (respecting nested comments, escaped strings...) would be to use the former lexer, It would need to be switched between both lexers, is this all possibe?. Cheers, Till