From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 1039CBB81 for ; Fri, 23 Sep 2005 11:29:59 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j8N9TwF1020436 for ; Fri, 23 Sep 2005 11:29:58 +0200 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 LAA16462 for ; Fri, 23 Sep 2005 11:29:58 +0200 (MET DST) Received: from smtp15.wanadoo.fr (smtp15.wanadoo.fr [193.252.23.84]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j8N9Tv9D010537 for ; Fri, 23 Sep 2005 11:29:57 +0200 Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf1501.wanadoo.fr (SMTP Server) with ESMTP id A52A8700008D for ; Fri, 23 Sep 2005 11:29:57 +0200 (CEST) Received: from wwinf1502 (wwinf1502 [172.22.146.29]) by mwinf1501.wanadoo.fr (SMTP Server) with ESMTP id 99EAC700008A; Fri, 23 Sep 2005 11:29:57 +0200 (CEST) X-ME-UUID: 20050923092957630.99EAC700008A@mwinf1501.wanadoo.fr Message-ID: <6807416.1127467797619.JavaMail.www@wwinf1502> From: yoann padioleau Reply-To: padator@wanadoo.fr To: Alex Baretta Subject: Re: [Caml-list] Yacc limitations Cc: Ocaml Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [193.54.76.165] X-Wum-Nature: EMAIL-NATURE X-WUM-FROM: |~| X-WUM-TO: |~| X-WUM-CC: |~| X-WUM-REPLYTO: |~| Date: Fri, 23 Sep 2005 11:29:57 +0200 (CEST) X-Miltered: at nez-perce with ID 4333CB16.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 4333CB15.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 grammar:01 ocamlyacc:01 context-free:01 token:01 grammar:01 token:01 context-free:01 semantics:01 syntax:01 semantics:01 non-terminal:01 undecidable:01 iirc:01 parsing:01 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 > > What is the problem with your SQL grammar and with ocamlyacc ? > > The problem is that context-free is bad. Did you ever see or hear of any > real language where the context of a token is not meaningful? Even with a context free grammar I can capture the context of a token. in S -> A B token C I control that token is in the context of having A B before and C after. > It is > often possible and sometimes easy to describe the set of strings > belonging to a language in terms of a context-free grammar, but it is > very difficult in general to describe *the semantics* of that set of > strings without reference to the context. Because grammar is about syntax, not semantics. The same is true for natural langage. Now let's say that you can write context free grammar for your SQL langage, what would you write ? You now have the ability to put multiple non-terminal at the left of the rule, such as in A B C -> D What would you write for your SQL grammar ? > > Now, I don't necessarily ask for undecidable generalized > grammars--although IIRC the camlp4 parsing engine actually provides them > as LL1+backtracking. I would be more than happy to have a smarter > context-free yacc-like tool providing human readable explanations of > syntactic conflicts. Yes a better explanation of conflicts is something I would like too.