English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
Re: [Caml-list] Yacc limitations
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-09-23 (09:29)
From: yoann padioleau <padator@w...>
Subject: Re: [Caml-list] Yacc limitations
> > 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.
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.