bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Where is yacc_EOF defined?


From: Eric Blake
Subject: Re: Where is yacc_EOF defined?
Date: Wed, 6 Feb 2019 16:56:54 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0

On 2/6/19 4:33 PM, Peng Yu wrote:
> Hi,
> 
> yacc_EOF is mentioned in parse.y in something like this
> 
> %left '&' ';' '\n' yacc_EOF
>   | error yacc_EOF
> 
> But I don't find where it is defined similarly to other tokens like BAR_AND.

Then you aren't very familiar with yacc.  Per 'man yacc':

       The following declares name to be a token:

           %token [<tag>] name [number] [name [number]]...

       If tag is present, the C type for all tokens  on  this  line
shall  be
       declared to be the type referenced by tag.  If a positive
integer, num‐
       ber, follows a name, that value shall be assigned to the token.

       The following declares name to be a token, and  assigns
precedence  to
       it:

           %left [<tag>] name [number] [name [number]]...
           %right [<tag>] name [number] [name [number]]...

So, the %left line that you quoted above IS what defined yacc_EOF to be
a token.

If you've never used yacc/bison before, trying to learn how they work by
using bash as your starting point is a rather heavy crash-course.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]