From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id WAA01879; Thu, 11 Oct 2001 22:21:50 +0200 (MET DST) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id WAA01852 for ; Thu, 11 Oct 2001 22:21:44 +0200 (MET DST) Received: from mail.mimuw.edu.pl (pp30.warszawa.cvx.ppp.tpnet.pl [213.76.111.30]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id f9BKLcn02510 for ; Thu, 11 Oct 2001 22:21:39 +0200 (MET DST) Received: (from news@localhost) by mail.mimuw.edu.pl (PLD/8.9.3) id WAA08688 for caml-list@inria.fr; Thu, 11 Oct 2001 22:13:21 +0200 X-Authentication-Warning: qrnik.zagroda: news set sender to Marcin 'Qrczak' Kowalczyk using -f From: "Marcin 'Qrczak' Kowalczyk" Subject: Re: [Caml-list] Re: [Caml-announce] OCamldoc Date: 11 Oct 2001 20:13:17 GMT Organization: Klub Nieszkodliwych =?iso-8859-2?Q?Manjak=F3w?= Message-ID: References: <8E31D6933A2FE64F8AE3CC1381EEDCE7140166@NT.kal.com> <4066.1002712085@saul.cis.upenn.edu> <9q4tft$88t$1@qrnik.zagroda> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-2 Content-Transfer-Encoding: 8bit X-Trace: qrnik.zagroda 1002831197 8686 192.168.0.1 (11 Oct 2001 20:13:17 GMT) X-Complaints-To: news@qrnik.zagroda NNTP-Posting-Date: 11 Oct 2001 20:13:17 GMT User-Agent: slrn/0.9.7.2 (Linux) To: caml-list@inria.fr Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Thu, 11 Oct 2001 21:32:11 +0200, Xavier Leroy pisze: > But: languages where indentation is significant (Haskell, Occam, > Python) have bad reputation as being 1- harder to parse (for a > program), and 2- intolerant w.r.t. cut-and-paste or machine-generated > code. 2- is perhaps less of a problem for documentation comments > (they are rarely machine-generated :-), but 1- worries me. I've been > hacking Lex and Yacc for years, still I do not have the slightest idea > on how to take indentation into account in a Lex/Yacc parser... I've recently implemented a toy language with significant layout. Conclusions: It's easy to parse with a lexer written by hand and a parser generated by Happy (Yacc for Haskell). What is needed (and what Happy provides): a state threaded through both lexer and parser. The lexer converts layout to virtual brackets of some sort and virtual semicolons. It's easy to write a lexer by hand in a functional language. I don't know about handling layout with Lex. Parsing is not affected by layout. Significant layout is practical for languages with enough static checking (either by static typing or by a redundant grammar). It's impractical for languages where almost any sequence of tokens is valid at compile time. In particular it works for Haskell (both reasons) and Python (grammar with enough amount of redundancy). It didn't work well for my language :-) I'm sure it would work for core OCaml, but there might be problems with ocamldoc if errors in layout of special comments are generally not catched and just change the meaning. -- __("< Marcin Kowalczyk * qrczak@knm.org.pl http://qrczak.ids.net.pl/ \__/ ^^ SYGNATURA ZASTĘPCZA QRCZAK ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr