Version française
Home     About     Download     Resources     Contact us    
Browse thread
Yacc limitations
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Alan Falloon <Al.Falloon@s...>
Subject: Re: [Caml-list] Yacc limitations
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