Code Comments
Programming Forum and web based access to our favorite programming groups.Hi all,
I am wondering if there are some newer reliable engines
similar to yacc/bison, but with more syntactic sugar and
wider class of the grammars.
In particular some ideas/notions of regular expression
would be fine. For example, something like:
e? Matches element e in brackets zero or one times
e* Matches element e in brackets zero or more times
e+ Matches element e in brackets one or more times
e{num} Matches element e in brackets num times
e{min, max} Matches element e in brackets at least min times, but
not more than max times
where element e might be a compound elemnt embraced, say,
in brackets if needed.
Absence of this sugar makes the grammar description
less readable.
Consider this short example (BTW it comes from real life):
[example]
Rule: [a [b?a]* b? ]?
[/example]
Would it ever be same readable in bison/yacc grammar? -- hardly.
Indeed let's look into intuitive bison equivalent:
[example]
%%
%term a
%term b
Rule:
| a ba_seq_opt
| a ba_seq_opt b
;
ba_seq_opt:
| ba ba_seq_opt
;
ba: a
| b a
;
[/example]
It is hardly more readable and in addition
brings 2 "artificial" shift/reduce conflicts...
Thus, any testimonials to reliable grammar parser generators
are very appreciated. (Commercial implementatios are
less considered). In particular, recommendations to
free implementations from this list:
http://www.programming-x.com/programming/parser.html
would be very interesting as well.
Best regards,
thank you in advance,
Valery A.Khamenya
Post Follow-up to this messagekhamenya@mail.ru (Valery) wrote:
> I am wondering if there are some newer reliable engines
> similar to yacc/bison, but with more syntactic sugar and
> wider class of the grammars.
...
The notation you describe is almost exactly that of Yacc++, except we
don't do the finite length versions:
e{num} Matches element e in brackets num times
e{min, max} Matches element e in brackets at least min times, but
not more than max times
> Thus, any testimonials to reliable grammar parser generators are
> very appreciated. (Commercial implementatios are less considered).
It does have the problem that it is not freely available currently.
If you are planning non-commercial use, you could send us email at the
address in the .signature and we can discuss whether something can be
done for your situation, as we do intend to release a free (both
gratis and libre meanings) copy of an older version of the software in
the "near" future, say the beginning of 2005.
As to testimonials, you can read the "customer quotes" on the web
page. I cannot offer one myself, as I am one of the authors etc.
However, it does work for me ;-)....
Hope this helps,
-Chris
****************************************
************************************
*
Chris Clark Internet : compres@world.std.com
Compiler Resources, Inc. Web Site : http://world.std.com/~compres
23 Bailey Rd voice : (508) 435-5016
Berlin, MA 01503 USA fax : (978) 838-0263 (24 hours)
Post Follow-up to this messageLe 28-07-2004, Valery <khamenya@mail.ru> a écrit_: > Hi all, > > I am wondering if there are some newer reliable engines > similar to yacc/bison, but with more syntactic sugar and > wider class of the grammars. > > In particular some ideas/notions of regular expression > would be fine. For example, something like: > > e? Matches element e in brackets zero or one times > e* Matches element e in brackets zero or more times > e+ Matches element e in brackets one or more times You should consider using PCCTS (or ANTLR), http://www.antlr.org/ or maybe the COCOM kit http://cocom.sourceforge.net/ If you want to code your compiler or parser in Ocaml http://caml.inria.fr, you might consider using its Camlp4 - which provide syntax extensions to write parsers; However, you might have some issues with semantic processing (i.e. handling of attributes). Regards. -- Basile STARYNKEVITCH http://starynkevitch.net/Basile/ email: basile<at>starynkevitch<dot>net aliases: basile<at>tunes<dot>org = bstarynk<at>nerim<dot>net 8, rue de la Faïencerie, 92340 Bourg La Reine, France
Post Follow-up to this messageHi,
(Comments below)
Valery wrote:
> Hi all,
>
> I am wondering if there are some newer reliable engines
> similar to yacc/bison, but with more syntactic sugar and
> wider class of the grammars.
>
> In particular some ideas/notions of regular expression
> would be fine. For example, something like:
>
> e? Matches element e in brackets zero or one times
> e* Matches element e in brackets zero or more times
> e+ Matches element e in brackets one or more times
> e{num} Matches element e in brackets num times
> e{min, max} Matches element e in brackets at least min times, but
> not more than max times
I'm working on one that uses
e? or [e] Zero or one.
e* or {e} Zero or more.
e+ One or more. (Could see a good bracket form.)
>
> where element e might be a compound elemnt embraced, say,
> in brackets if needed.
I use (e).
>
> Absence of this sugar makes the grammar description
> less readable.
I wanted to be able to enter grammars that are similar to those
published for languages.
I also allow := as a synonym for : and . as a synonym for ;
>
> Consider this short example (BTW it comes from real life):
>
> [example]
> Rule: [a [b?a]* b? ]?
> [/example]
This would be:
Rule: (a (b?a)* b?)?;
in mine.
[Yacc example snipped]
> Thus, any testimonials to reliable grammar parser generators
> are very appreciated. (Commercial implementatios are
> less considered). In particular, recommendations to
> free implementations from this list:
>
> http://www.programming-x.com/programming/parser.html
>
> would be very interesting as well.
>
> Best regards,
> thank you in advance,
> Valery A.Khamenya
Unfortunately, mine is a personal project that I've been working on. I'm
not sure it it will ever be available, but I'm having a lot of fun
writing it.
You can find more information on it on my web site.
Best regards,
Rich
--
Richard Pennington
Email: rich@pennware.com
http://www.pennware.com ftp://ftp.pennware.com
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.