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 mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 567ADBC37 for ; Sat, 14 Nov 2009 17:20:14 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AugBAEJn/krVpUAUkGdsb2JhbACEcpcsAQEBAQkJDAcTA6YvkEeBMII4VAQ X-IronPort-AV: E=Sophos;i="4.44,742,1249250400"; d="scan'208";a="40110813" Received: from mail.gmx.net ([213.165.64.20]) by mail1-smtp-roc.national.inria.fr with SMTP; 14 Nov 2009 17:20:14 +0100 Received: (qmail invoked by alias); 14 Nov 2009 16:20:12 -0000 Received: from X9e6e.x.pppool.de (EHLO termite.localnet) [89.59.158.110] by mail.gmx.net (mp023) with SMTP; 14 Nov 2009 17:20:12 +0100 X-Authenticated: #20477425 X-Provags-ID: V01U2FsdGVkX18p8D4fy3QpqNzR1a/tQ4tNBxTM7FCpVjA1Yk03/2 EIzRy8Vay99D/P From: Micha To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] The lexer hack Date: Sat, 14 Nov 2009 17:20:13 +0100 User-Agent: KMail/1.12.0 (Linux/2.6.29-2.slh.3-sidux-amd64; KDE/4.3.1; x86_64; ; ) Cc: Dario Teixeira References: <514622.64398.qm@web111510.mail.gq1.yahoo.com> In-Reply-To: <514622.64398.qm@web111510.mail.gq1.yahoo.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <200911141720.13847.micha-1@fantasymail.de> X-Y-GMX-Trusted: 0 X-FuHaFi: 0.66 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 wrote:01 parsing:01 caml-list:01 grammar:02 hack:04 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