caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Alex Baretta <alex@barettadeit.com>
To: padator@wanadoo.fr
Cc: Ocaml <caml-list@inria.fr>
Subject: Re: [Caml-list] Yacc limitations
Date: Fri, 23 Sep 2005 14:51:00 +0200	[thread overview]
Message-ID: <4333FA34.5000305@barettadeit.com> (raw)
In-Reply-To: <6807416.1127467797619.JavaMail.www@wwinf1502>

yoann padioleau wrote:
>>>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 

Sometimes you can capture enough. Sometimes not enough. The point is
that some of the alternative expansions of S are meaningful in some
contexts and not in others.

> Because grammar is about syntax, not semantics. The same is true for natural langage. 

Not quite. Remember "semantic actions"? A parser generator like yacc
maps semantics onto a set of strings by recognizing structures generated
by a grammar. We are hardly ever interested in recognizing but almost
always in "semantizing" a string of a language.

> 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 ? 

I'm not sure what I would write in a generalized grammar framework. What
I definitely sometimes feel the need for is the possibility of selecting
within a semantic action the set of "active" productions which are the
parser is "allowed" to use until further notice. This would allow me to
provide an explicit distinction in cases where contextual
information--implicitly available within the scope of a semantic
action--allows to discriminate any ambiguity in the production rules.

Alex


-- 
*********************************************************************
http://www.barettadeit.com/
Baretta DE&IT
A division of Baretta SRL

tel. +39 02 370 111 55
fax. +39 02 370 111 54

Our technology:

The Application System/Xcaml (AS/Xcaml)
<http://www.asxcaml.org/>

The FreerP Project
<http://www.freerp.org/>


  reply	other threads:[~2005-09-23 12:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-23  9:29 yoann padioleau
2005-09-23 12:51 ` Alex Baretta [this message]
  -- strict thread matches above, loose matches on Subject: below --
2005-09-22 16:46 yoann padioleau
2005-09-22 17:08 ` brogoff
2005-09-22  9:57 Alex Baretta
2005-09-22 13:09 ` [Caml-list] " Christophe Raffalli
2005-09-26 11:54   ` Pierre Boulet
     [not found] ` <4332ACF2.6020702@univ-savoie.fr>
2005-09-22 14:05   ` Alex Baretta
2005-09-22 16:37 ` Christophe TROESTLER
2005-09-23  6:05 ` Jake A. Kirilenko
2005-09-23 15:30 ` Alan Falloon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4333FA34.5000305@barettadeit.com \
    --to=alex@barettadeit.com \
    --cc=caml-list@inria.fr \
    --cc=padator@wanadoo.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).