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