On Fri, 22 Jul 2011 08:33:50 +0200 Lucio De Re <[email protected]>  wrote:
> On Fri, Jul 22, 2011 at 05:36:42AM +0000, [email protected] wrote:
> > 
> > Does Go use things that are bison-specific?  If not, maybe Berkeley Yacc
> > (there are various versions around) would be easier to port.
> > 
> That's why I ask about Bison experts, it's hard to tell how deep the
> usage of bison-specific features goes without some familiarity.  I do
> suspect that there is a whole generation of programmers out there that
> only knows the GNU dialects and I'm not a member of that club.
> 
> I am only slightly curious about BSD Yacc (is that what NetBSD uses,
> I wonder?) as my education stopped short of compiler construction
> principles. Back then compiler generators were still a novelty.

You shouldn't need to dig into yacc.

I see from Make.* that has bison -y -d is used, which means it
is supposed emulate posix yacc.  Just to check I tried with
yaccing with the FreeBSD yacc:

*a/a.y          -- ok
cc/cc.y         -- ok
goyacc/units.y  -- ok 


$ yacc gc/go.y
yacc: e - line 120 of "go.y", syntax error
%error-verbose
^
This is a bison dropping. I haven't looked at the go sources
but hopefully this can be worked around easily.

I didn't actually run any of the generated code but given the
-y flag I have hopes.... In the worst can you can write a
bison script around byacc and massage what needs to be.

Try compiling /usr/src/usr.bin/yacc from *BSD. Let me know if
you run into problems.

Reply via email to