Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

anything more convenient then bison/yacc?
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

Report this thread to moderator Post Follow-up to this message
Old Post
Valery
07-29-04 02:08 AM


Re: anything more convenient then bison/yacc?
khamenya@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)

Report this thread to moderator Post Follow-up to this message
Old Post
Chris F Clark
08-04-04 08:57 AM


Re: anything more convenient then bison/yacc?
Le 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


Report this thread to moderator Post Follow-up to this message
Old Post
Basile Starynkevitch [news]
08-05-04 08:59 PM


Re: anything more convenient then bison/yacc?
Hi,

(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

Report this thread to moderator Post Follow-up to this message
Old Post
Richard Pennington
08-09-04 08:56 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Compilers archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 04:27 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.