[build2] Yacc module?

Joachim Kuebart joachim.kuebart at gmail.com
Wed Sep 18 21:39:53 UTC 2019

Hi Boris,

thanks again for your help. I was busy with other stuff for a while, and
I'm going to be away for the next three weeks, so this is how far I've
come, see https://gitlab.com/jkuebart/libbuild2-yacc.git.

On Wed, 4 Sep 2019 at 16:29, Boris Kolpackov <boris at codesynthesis.com> wrote:
> Joachim Kuebart <joachim.kuebart at gmail.com> writes:
> > I've started with the yacc module[0], but I'm not claiming to really
> > understand what I'm doing yet ;-). I'm currently stuck where none of
> > my compile_rule's methods are being called by the test even though I
> > added y{**} and a corresponding file.. will need to look into that
> > later.
> I took a look and the problem is actually in your test's buildfile:
> exe{basics}: {hxx ixx txx cxx}{**} y{**} $libs
> While the .y dependency is there, the link rule doesn't recognize
> and thus match it. If however, I add this before:
> ./: y{**}
> I get:
> trace: yacc::compile_rule::match: match((2,2), .../libbuild2-yacc/libbuild2-yacc-tests/basics/y{hello.y})
> trace: yacc::compile_rule::apply: apply((2,2), .../libbuild2-yacc/libbuild2-yacc-tests/basics/y{hello.y})
> This does the trick because the alias rule (the `./` target is an alias)
> matches all of the target's prerequisites.

Yes, that works! I now have

tab.c{hello}: y{**}

exe{basics}: {hxx ixx txx cxx}{**} tab.c{**} $libs

which works, but I wonder if there's a way to just say

exe{basics}: … y{**} …

> > On the "yacc" branch [1], I have included a OpenBSD's yacc which has
> > no dependencies except for one OpenBSD library function which I also
> > included. I haven't looked at libyacc yet though. If we were to go
> > down the route of including yacc, I think it should be installed
> > somewhere out of the user's path (i.e. libexec/) and called directly.
> I am not sure we would normally even want to install it. It can just
> be used from its build directory.

Of course! I keep forgetting that we can assume that the build directory is
available. I merged the yacc branch.

I've now got a version which gets as far as invoking yacc. I haven't looked
at the configuration side yet and I'm not sure how to get the path to the
binary that was built in libbuild2-yacc/yacc.

Also, the system seems to derive a name of hello.c for hello.y while it
should be hello.tab.c so it works with yacc's -b option. Not sure how to
fix that yet.



More information about the users mailing list