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=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 0129BBC6B for ; Thu, 19 Apr 2007 09:42:21 +0200 (CEST) Received: from smeltpunt.science.ru.nl (smeltpunt.science.ru.nl [131.174.16.145]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l3J7gLpS024367 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Thu, 19 Apr 2007 09:42:21 +0200 Received: from tandem.cs.ru.nl [131.174.142.18] (helo=tandem.cs.ru.nl) by smeltpunt.science.ru.nl (8.13.7/5.11) with ESMTP id l3J7gKEV026619 for ; Thu, 19 Apr 2007 09:42:20 +0200 (MEST) Received: from tews by tandem.cs.ru.nl with local (Exim 4.63) (envelope-from ) id 1HeRHa-0005Ae-4s for caml-list@yquem.inria.fr; Thu, 19 Apr 2007 09:42:22 +0200 From: Hendrik Tews To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] using different lexers with one parser? References: <20070417203311.GA553@first.in-berlin.de> <20070418100142.GD336@first.in-berlin.de> <1176906070.15945.39.camel@rosella.wigram> Date: Thu, 19 Apr 2007 09:42:22 +0200 In-Reply-To: <1176906070.15945.39.camel@rosella.wigram> (skaller@users.sourceforge.net's message of "Thu, 19 Apr 2007 00:21:10 +1000") Message-ID: User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Scanned-By: MIMEDefang 2.56 on 131.174.16.145 X-Miltered: at discorde with ID 46271D5D.001 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; hendrik:01 tews:01 tews:01 lexers:01 parser:01 lexer:01 hendrik:01 sourceforge:01 token:01 token:01 caml-list:01 writes:01 grammar:01 grammar:01 precisely:01 skaller writes: This leaves the problem of the lookahead token, which may or may not exist. You can predict whether it exists for each reduction. You can do this 'mentally' by asking "Does this production have a definite set of terminators, (no lookahead) or does it rely on bumping into something unrecognizable (lookahead)"? I believe that in the grammar.output file you can pretty easy see, which rules require a lookahead token. A state with two reduce rules or one shift and one reduce rules obviously needs a lookahead token. You would have to check that those reductions that change the lexer are done in a state with precisely one reduction. Of course you would have to do that every time you change the grammar... Bye, Hendrik