From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 559B8D45F for ; Mon, 31 Oct 2005 23:32:26 +0100 (CET) Received: from smtp2.syd.swiftdsl.com.au (smtp2.syd.swiftdsl.com.au [218.214.225.98]) by concorde.inria.fr (8.13.0/8.13.0) with SMTP id j9VMWNcX004761 for ; Mon, 31 Oct 2005 23:32:25 +0100 Received: (qmail 911 invoked from network); 31 Oct 2005 22:32:21 -0000 Received: from unknown (HELO coltrane.mega-nerd.net) (218.214.64.136) by smtp2.syd.swiftdsl.com.au with SMTP; 31 Oct 2005 22:32:21 -0000 Received: from coltrane (localhost [127.0.0.1]) by coltrane.mega-nerd.net (Postfix) with SMTP id 681987B66 for ; Tue, 1 Nov 2005 09:32:15 +1100 (EST) Date: Tue, 1 Nov 2005 09:32:14 +1100 From: Erik de Castro Lopo To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Parser state variables Message-Id: <20051101093214.05fc8d96.ocaml-erikd@mega-nerd.com> In-Reply-To: <4361C38B.8090309@inria.fr> References: <1130398547.7544.66.camel@rosella> <4361C38B.8090309@inria.fr> Organization: Erik Conspiracy Secret Labs X-Mailer: Sylpheed version 2.0.0 (GTK+ 2.6.10; i486-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 43669B77.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 parser:01 frisch:01 token:01 token:01 lexer:01 parser:01 tokens:01 verses:98 wrote:01 functions:01 argument:01 semantic:02 variables:02 modifies:02 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 Alain Frisch wrote: > Another one is to make semantic actions return functions which take the > state as an argument. I've also used a variation on this which places a filter function with signature filter : state -> token -> token between the lexer and the parser and modifies the stream of tokens as required by the current state. Erik -- +-----------------------------------------------------------+ Erik de Castro Lopo +-----------------------------------------------------------+ "Death is perhaps too easy" -- Iqbal Sacranie in 1989 about Salman Rushdie, author of "The Satanic Verses". Sacranie received a knighthood in 2005 as the face of 'moderate' British Islam. He has never disowned his earlier statement.