caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Re: [Caml-list] Yacc limitations
@ 2005-09-23  9:29 yoann padioleau
  2005-09-23 12:51 ` Alex Baretta
  0 siblings, 1 reply; 10+ messages in thread
From: yoann padioleau @ 2005-09-23  9:29 UTC (permalink / raw)
  To: Alex Baretta; +Cc: Ocaml

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





^ permalink raw reply	[flat|nested] 10+ messages in thread
* Re: [Caml-list] Yacc limitations
@ 2005-09-22 16:46 yoann padioleau
  2005-09-22 17:08 ` brogoff
  0 siblings, 1 reply; 10+ messages in thread
From: yoann padioleau @ 2005-09-22 16:46 UTC (permalink / raw)
  To: Alex Baretta, Ocaml

> I am getting very much annoyed with the obtusity of the LALR-yacc parser
> generators. I have unsurmountable difficulties at teaching ocamlyacc how
> to parse SQL decently.
> 
> What is the "way to go" in terms of parser generators for Ocaml? I'd
> like to see if there is some level of agreement in the community on this
> issue.

I personnaly use ocamlyacc and even if there is some difficulties, I like it.
The problems is when there is an ambiguity in the grammar, in which case I look at the output file
generated by ocamlyacc -v, C-s "conflict" in the file,  and hope that my brain will find an easy solution.

All the ocaml project that I know that need some complex parsing use ocamlyacc. 
Some people also use streams but are limited to write LL(1) grammars.
Some people use parser combinators to do the same kind of stuff that stream offers. 

What is the problem with your SQL grammar and with ocamlyacc ? 





^ permalink raw reply	[flat|nested] 10+ messages in thread
* Yacc limitations
@ 2005-09-22  9:57 Alex Baretta
  2005-09-22 13:09 ` [Caml-list] " Christophe Raffalli
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Alex Baretta @ 2005-09-22  9:57 UTC (permalink / raw)
  To: Ocaml

I am getting very much annoyed with the obtusity of the LALR-yacc parser
generators. I have unsurmountable difficulties at teaching ocamlyacc how
to parse SQL decently.

What is the "way to go" in terms of parser generators for Ocaml? I'd
like to see if there is some level of agreement in the community on this
issue.

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


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2005-09-26 11:53 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-09-23  9:29 [Caml-list] Yacc limitations yoann padioleau
2005-09-23 12:51 ` Alex Baretta
  -- 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

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).