Unix Programming - prefix for yacc/bison

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > July 2005 > prefix for yacc/bison





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author prefix for yacc/bison
Christian Christmann

2005-07-12, 2:48 am

Hi,

sorry, this question is offtopic, but didn't find any other newsgroup to
ask.
A question on yacc/bison: I've to work on two different machines. One of
them is using yacc the other is using bison (by default as replacement for
yacc). For a yacc file I've to change the default prefix yy. Thus, I've
added the line %name-prefix="aa". This works fine for bison but issues an
syntax error with yacc.

Is there a way to change the prefix which work for both yacc and bison?

Thank you
Chris
Torsten Mueller

2005-07-12, 2:48 am

Christian Christmann <plfriko@yahoo.de> schrieb:

> %name-prefix="aa"


This is implementation dependent, I think. Even not every yacc
understands this.

> Is there a way to change the prefix which work for both yacc and
> bison?


There's parameter -p or --file-prefix.

If you want a directive you can use %file-prefix="aa".

T.M.
Chuck Dillon

2005-07-12, 5:57 pm

Christian Christmann wrote:
> Hi,
>
> sorry, this question is offtopic, but didn't find any other newsgroup to
> ask.
> A question on yacc/bison: I've to work on two different machines. One of
> them is using yacc the other is using bison (by default as replacement for
> yacc). For a yacc file I've to change the default prefix yy. Thus, I've
> added the line %name-prefix="aa". This works fine for bison but issues an
> syntax error with yacc.
>
> Is there a way to change the prefix which work for both yacc and bison?


Use sed.

FWIW... I used to maintain some lex/yacc code that had to run on
several platforms. The way we did it was to build the lex/yacc code
into C sources on one standard platform, in our case Solaris, and then
use the C code in builds on the others. We use some sed filters to
deal with some compiler differences and to massage the C code (to make
it reentrant).

-- ced


--
Chuck Dillon
Senior Software Engineer
NimbleGen Systems Inc.
Kamal R. Prasad

2005-07-13, 2:48 am

Yes -at least on AIX, the -p <prefix> tells yacc to replace yy by
<prefix> everywhere. Initially, yacc didn't have any of those bells and
whistles, but bison sort of induced changes elsewhere.
The forum for this is comp.compilers. The moderator though is picky on
what he wants to allow for posting. I suspect he considrs himself god's
representative for the forum.

regards
-kamal

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com