caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* 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; 7+ 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] 7+ messages in thread

* Re: [Caml-list] Yacc limitations
  2005-09-22  9:57 Yacc limitations Alex Baretta
@ 2005-09-22 13:09 ` Christophe Raffalli
  2005-09-26 11:54   ` Pierre Boulet
       [not found] ` <4332ACF2.6020702@univ-savoie.fr>
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 7+ messages in thread
From: Christophe Raffalli @ 2005-09-22 13:09 UTC (permalink / raw)
  To: caml-list

Alex Baretta a écrit :
> 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.
> 

may be give a try to elkhound
(http://www.cs.berkeley.edu/~smcpeak/elkhound/) ? It generated both
OCaml and C++. I haven't used it, But it seems nice and will remove the
LALR(1) constraint .


> Alex
> 
> 


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

* Re: [Caml-list] Yacc limitations
       [not found] ` <4332ACF2.6020702@univ-savoie.fr>
@ 2005-09-22 14:05   ` Alex Baretta
  0 siblings, 0 replies; 7+ messages in thread
From: Alex Baretta @ 2005-09-22 14:05 UTC (permalink / raw)
  To: Christophe Raffalli, Ocaml

Christophe Raffalli wrote:
> Alex Baretta a écrit :
> 
>> 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.
>>
> 
> may be give a try to elkhound
> (http://www.cs.berkeley.edu/~smcpeak/elkhound/) ? It generated both
> OCaml and C++. I haven't used it, But it seems nice and will remove the
> LALR(1) constraint .

Elkhound is C++ stuff. I really would prefer to avoid having to
introduce C++ in my toolchain. Is it possible to install Elkhound as a
Debian package and forget about it?

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] 7+ messages in thread

* Re: [Caml-list] Yacc limitations
  2005-09-22  9:57 Yacc limitations Alex Baretta
  2005-09-22 13:09 ` [Caml-list] " Christophe Raffalli
       [not found] ` <4332ACF2.6020702@univ-savoie.fr>
@ 2005-09-22 16:37 ` Christophe TROESTLER
  2005-09-23  6:05 ` Jake A. Kirilenko
  2005-09-23 15:30 ` Alan Falloon
  4 siblings, 0 replies; 7+ messages in thread
From: Christophe TROESTLER @ 2005-09-22 16:37 UTC (permalink / raw)
  To: alex; +Cc: caml-list

On Thu, 22 Sep 2005, Alex Baretta <alex@barettadeit.com> wrote:
> 
> 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.

Maybe you could write an OCaml backend for ANTLR
(http://www.antlr.org/) for which a SQL2 grammar is already available?

My 2¢,
ChriS


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

* Re: [Caml-list] Yacc limitations
  2005-09-22  9:57 Yacc limitations Alex Baretta
                   ` (2 preceding siblings ...)
  2005-09-22 16:37 ` Christophe TROESTLER
@ 2005-09-23  6:05 ` Jake A. Kirilenko
  2005-09-23 15:30 ` Alan Falloon
  4 siblings, 0 replies; 7+ messages in thread
From: Jake A. Kirilenko @ 2005-09-23  6:05 UTC (permalink / raw)
  To: Alex Baretta; +Cc: Ocaml

Hello Alex,

Thursday, September 22, 2005, 1:57:03 PM, you wrote:

I'm  developing  a  RD  parser  generator  (YARD)  in  pure Ocaml that
combines  modern  ideas  about functional parsers. I have not analyzed
the  class  of  grammars  being parsed but it is wider then CFG. Smth
about left attributed but I am not ready to discuss this topic.
Short example of rule `iter' that applies argument `a' `n' times:

iter[a n] : => n > 0 =>   <hd> = a  <tl> = iter[ a  (n - 1)] {hd::tl}
           | => n = 0 => {[]}
(  `=> ... =>' is a predicate/guardian, `<..>' is a binding)
           
Do you believe that this kind of parsers are able to parse SQL?

YARD  is open source project, but I have not published sources yet but
if somebody is interested I will. Generator (YARD) is ready to be used
and is being used in our projects, but it rapidly changes =). YARD

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

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

AB> Alex





Best regards,
 Jake                            mailto:jake@freemail.ru



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

* Re: [Caml-list] Yacc limitations
  2005-09-22  9:57 Yacc limitations Alex Baretta
                   ` (3 preceding siblings ...)
  2005-09-23  6:05 ` Jake A. Kirilenko
@ 2005-09-23 15:30 ` Alan Falloon
  4 siblings, 0 replies; 7+ messages in thread
From: Alan Falloon @ 2005-09-23 15:30 UTC (permalink / raw)
  To: Ocaml

Alex Baretta wrote:

>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 am not very familiar with SQL, so I may be missing something 
important, but a quick google search for 'sql grammar' turned up what 
appears to be an LALR grammer already in *yacc syntax at 
http://docs.openlinksw.com/virtuoso/GRAMMAR.html

I have also been frustrated in the past with yacc, bison, and ocamlyacc, 
but its usually not the LALR restriction as much as the lack of decent 
short-hand for common operations like a list of elements (with or 
without a separator token) which make the grammar a lot more verbose 
than it should really need to be. Also, with the C parser generators, it 
was always a huge pain to represent the parse tree in any reasonable 
way, but with ocaml and ocamlyacc that is a non-issue.

I do agree that debugging conflicts seems to be harder than it should 
be. It would be wonderful if that could be addressed.

As far as the LALR restriction goes, bison has an optional GLR parser 
(see http://www.delorie.com/gnu/docs/bison/bison_90.html) that seems 
like it could be added to ocamlyacc with a pretty straightforward 
translation if anyone had the time and motivation to do it.

--
Alan Falloon


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

* Re: [Caml-list] Yacc limitations
  2005-09-22 13:09 ` [Caml-list] " Christophe Raffalli
@ 2005-09-26 11:54   ` Pierre Boulet
  0 siblings, 0 replies; 7+ messages in thread
From: Pierre Boulet @ 2005-09-26 11:54 UTC (permalink / raw)
  To: Christophe Raffalli; +Cc: caml-list

Hi,

I like using Camlp4 for that purpose. It has a very convenient way to 
write parsers (the EXTEND notation). Its power is not directly 
comparable to LALR but I find it suiting my needs (at least it is enough 
to parse ocaml). The main pain is writing the lexer that feeds the 
parser. That I remember from the early days of camlp4, it may have changed.

Regards,

Pierre.

Christophe Raffalli a écrit :
> Alex Baretta a écrit :
> 
>> 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.
>>
> 
> may be give a try to elkhound
> (http://www.cs.berkeley.edu/~smcpeak/elkhound/) ? It generated both
> OCaml and C++. I haven't used it, But it seems nice and will remove the
> LALR(1) constraint .
> 
> 
>> Alex
>>
>>
> 
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs


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

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

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-09-22  9:57 Yacc limitations 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).