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 UAA22935; Fri, 13 Aug 2004 20:10:11 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id UAA25233 for ; Fri, 13 Aug 2004 20:10:09 +0200 (MET DST) Received: from asmtp-a063f35.pas.sa.earthlink.net (asmtp-a063f35.pas.sa.earthlink.net [207.217.120.220]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i7DIA8RM028351 for ; Fri, 13 Aug 2004 20:10:08 +0200 Received: from 65-103-213-184.tcsn.qwest.net ([65.103.213.184] helo=dylan) by asmtp-a063f35.pas.sa.earthlink.net with asmtp (Exim 4.34) id 1BvgVD-0004Ts-GB for caml-list@inria.fr; Fri, 13 Aug 2004 11:10:07 -0700 Message-ID: <006b01c48160$f932dc40$0401000a@dylan> From: "David McClain" To: "caml" Subject: [Caml-list] CFG's and Camlp4 Date: Fri, 13 Aug 2004 11:11:31 -0700 MIME-Version: 1.0 Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1437 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 X-ELNK-Trace: 7a0ab3eafc8cf994b22988ad1c62733440683398e744b8a428b0fb7bf2846b98dfaefe2e22f3a784a7ce0e8f8d31aa3f350badd9bab72f9c350badd9bab72f9c X-Originating-IP: 65.103.213.184 X-Miltered: at concorde with ID 411D0400.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; mcclain:01 dmcclain:01 camlp:01 camlp:01 extensible:01 rescue:99 lalr:01 lalr:01 dynamically:01 extensible:01 mcclain:01 compilers:01 ocaml:01 approaches:01 lisp:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Actually, after having put off learning Camlp4 for quite some time because it seemed so arcane, I now decided at the urging of several people to dig into it. I have to say that I am quite impressed. Camlp4 represents a kind of paradigm shift that I was hoping to see when pleading for more modern approaches. In fact it seems so modern that I'm still trying to wrap my brain around it. Already I have several other uses for this preprocessing. But the idea of an extensible grammar, on the fly, is very appealing. I do huge amounts of Lisp macrology and came to miss that. I thought to myself that OCaml at least made up for it by being so darned convenient to use at the functional level that macros just seemed nonessential. But that isn't quite true, and now Camlp4 comes to the rescue. The difficulty I have been having with YACC seems to be caused by the reduction from LL(1) to LALR(1), where tables have shrunk by coalescing what appear to be common productions. That is in fact true for expressions and patterns. However, we (Inria and myself) both expect to use different semantic actions on these two similar syntactic breeds. That becomes problematic when the parser folds the two cases together. What I'm doing would probably work just fine in LL(1), but not entirely correctly in LALR(1). [I studied the "Dragon Book" many years ago, and was ever so grateful when that came to an end. I see now that many of my misconceptions about language grammar compilers were never properly reoriented during that period. I must also say that I much prefer the arcane new world of Camlp4. Perhaps I just like new ideas. I certainly do like new ideas that both work, and force my brain onto an entirely new plane. YACC was a great idea at the time. I know it still has heavy use -- I use it myself. But dynamically extensible grammars seem like a neat new idea.] David McClain Senior Corporate Scientist Avisere, Inc. +1.520.390.7738 (USA) david.mcclain@avisere.com ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners