From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 4BA1FBC37 for ; Sat, 14 Nov 2009 20:09:16 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AggBABuP/krZSMDdi2dsb2JhbACBTJpRAQEBCgsKBxEFtjCEPAQ X-IronPort-AV: E=Sophos;i="4.44,742,1249250400"; d="scan'208";a="36746524" Received: from fmmailgate01.web.de ([217.72.192.221]) by mail2-smtp-roc.national.inria.fr with ESMTP; 14 Nov 2009 20:09:16 +0100 Received: from smtp05.web.de (fmsmtp05.dlan.cinetic.de [172.20.4.166]) by fmmailgate01.web.de (Postfix) with ESMTP id 661B913AD6DBE; Sat, 14 Nov 2009 20:09:15 +0100 (CET) Received: from [95.208.117.111] (helo=frosties.localdomain) by smtp05.web.de with asmtp (TLSv1:AES256-SHA:256) (WEB.DE 4.110 #314) id 1N9Nzm-00028d-00; Sat, 14 Nov 2009 20:09:14 +0100 Received: from mrvn by frosties.localdomain with local (Exim 4.69) (envelope-from ) id 1N9Nzl-0008TR-KN; Sat, 14 Nov 2009 20:09:13 +0100 From: Goswin von Brederlow To: Micha Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] The lexer hack References: <514622.64398.qm@web111510.mail.gq1.yahoo.com> <200911141720.13847.micha-1@fantasymail.de> Date: Sat, 14 Nov 2009 20:09:13 +0100 In-Reply-To: <200911141720.13847.micha-1@fantasymail.de> (Micha's message of "Sat, 14 Nov 2009 17:20:13 +0100") Message-ID: <87hbsw3ova.fsf@frosties.localdomain> User-Agent: Gnus/5.110006 (No Gnus v0.6) XEmacs/21.4.22 (linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: goswin-v-b@web.de X-Sender: goswin-v-b@web.de X-Provags-ID: V01U2FsdGVkX19oo9hPw9Wsj8brQ1vlL0T7LudgpMs7SGftgQAw +sFloWDnlKU6QsOko2M5V9suYUu/HBuoPFhUpUaiCvqJeCZO0y Hi3oeAQV0= X-Spam: no; 0.00; lexer:01 parser:01 lexers:01 parser:01 lexing:01 lexer:01 compiler:01 tokens:01 10.:98 2009:98 mfg:98 wrote:01 parsing:01 caml-list:01 writes:01 Micha writes: > On Tuesday, 10. November 2009 15:42:52 Dario Teixeira wrote: >> Hi, >> >> I'm creating a parser for a LaTeX-ish language that features verbatim >> blocks. To handle them I want to switch lexers on-the-fly, depending on the >> parsing context. Therefore, I need the state from the (Menhir generated) >> parser to influence the lexing process (I believe this is called the "lexer >> hack" in compiler lore). > > if the lexer cannot decide it on the tokens seen, a packrat parser (like > Aurochs) may be a better choice, since in a PEG there is no seperate lexer, > it's all one grammar, so you don't have this problem. > > Michael There usualy must be something present to support '(* *)' and '""', i.e. comments and strings. Find out what is recommended for those and adapt it. MfG Goswin