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=AWL 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 8246BBC0A for ; Tue, 17 Apr 2007 22:33:17 +0200 (CEST) Received: from einhorn.in-berlin.de (einhorn.in-berlin.de [192.109.42.8]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l3HKXGA7001677 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Tue, 17 Apr 2007 22:33:17 +0200 X-Envelope-From: oliver@first.in-berlin.de X-Envelope-To: Received: from first (dslb-088-073-120-240.pools.arcor-ip.net [88.73.120.240]) (authenticated bits=0) by einhorn.in-berlin.de (8.13.6/8.13.6/Debian-1) with ESMTP id l3HKXGO2013410 for ; Tue, 17 Apr 2007 22:33:16 +0200 Received: by first (Postfix, from userid 501) id D638D3A8BD6; Tue, 17 Apr 2007 22:33:11 +0200 (CEST) Date: Tue, 17 Apr 2007 22:33:11 +0200 From: Oliver Bandel To: caml-list@inria.fr Subject: using different lexers with one parser? Message-ID: <20070417203311.GA553@first.in-berlin.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.6i X-Scanned-By: MIMEDefang_at_IN-Berlin_e.V. on 192.109.42.8 X-Miltered: at discorde with ID 46252F0C.002 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; bandel:01 in-berlin:01 lexers:01 parser:01 parsers:01 ocamlyacc:01 ocamlyacc:01 lexers:01 ocamllex:01 lexer:01 lexer:01 parsing:01 parser:01 mll:01 higher-level:01 Hello, using many parsers with ocamlyacc is possible, because ocamlyacc provides the possibility forusing moire than one start-token. Using many lexers is possible with ocamllex, because each lexer is a seperated function. Is it possible (without too much effort) to switch the lexer during parsing (from within the parser)? Or is better to a) implement calling of different lexers in the *.mll file or b) use many starting-points of the *.mly-file and work on the data from the outside of the parser (I'm meaning here: the function that calls the yacc-grammar-rule (start-rule)? So: does it rather make sense to make a higher-level parse on the data that the *.mly-parser gives back?! BTW: The data (line-based) I want to parse could otherwise be parsed relatively easy with regexp's; maybe this is the better way? Or is there a way to convert such context-dependend things to ocamllex/ocamlyacc-syntaxes? (It seems to me that similar problems arise, when parsing files like picture-files or movie-files (mpg or so).) TIA, Oliver