Boost logo

Boost-Build :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2005-10-20 02:35:54


Hi Alexey,

On Wednesday 19 October 2005 10:17, badyaev_alexey wrote:
> --- In jamboost_at_[hidden], Reece Dunn <msclrhd_at_h...> wrote:
> > exe citrus : main.c parser.lemon ;
> >
> > should be enough - bjam will pick up and compile both parser.c and
> > parser_opcodes.c.
>
> Thanks for your help! But I have error when building project now...
> Here is my lemon.jar:
>
> ##########################################################################
> # LEMON parser generator
> ##########################################################################
> import type ;
> import generators ;
>
> type.register LEMON : lemon ;
> generators.register-standard lemon.lemon
>
> : LEMON
> : C H C(opcodes) H(opcodes) ;

There were two problems in V2 on this generator.

1. It has two output targets of the same time. V2 mistakenly though there
are two different generators that can convert LEMON to C, and so reported an
ambiguity.

It is now fixed and committed. For convenience, the patch is attached.

2. Using of hardcoded name ("opcode") is this case was never supported, the
part in parenthesis should always contain "%". I can fix this, but I'm not
very keen on the idea. This will mean you can't have two .lemon sources in
one project, and the output file names will clash. I suggest this:

type.register LEMON : lemon ;
generators.register-standard lemon.lemon
: LEMON
: C H C(%_opcodes) H(%_opcodes) ;

which is similar to how another parser generator support in V2, whale.jam,
works.

HTH,
Volodya

-- 
Vladimir Prus
http://vladimir_prus.blogspot.com
Boost.Build V2: http://boost.org/boost-build2
 --Boundary-00=_bj0VD368MERGxRB Content-Type: text/x-diff;
charset="iso-8859-1";
name="generators.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="generators.diff"
Index: generators.jam
===================================================================
RCS file: /cvsroot/boost/boost/tools/build/v2/build/generators.jam,v
retrieving revision 1.93
diff -u -r1.93 generators.jam
--- generators.jam	3 Oct 2005 00:47:36 -0000	1.93
+++ generators.jam	20 Oct 2005 07:33:54 -0000
@@ -598,7 +598,11 @@
{
.generators += $(g) ;
- for local t in [ $(g).target-types ] 
+ # A generator can produce several targets of the
+ # same type. We want unique occurence of that generator
+ # in .generators.$(t) in that case, otherwise, it will
+ # be tried twice and we'll get false ambiguity.
+ for local t in [ sequence.unique [ $(g).target-types ] ]
{ 
.generators.$(t) += $(g) ;
} 
 --Boundary-00=_bj0VD368MERGxRB-- 

Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk