简体   繁体   中英

Typeless Nonterminal in Bison

From what I can tell, a Bison declaration is in the form
%type <type> nonterminal

Is there a way to define a nonterminal without giving it a type?

%type doesn't actually define a non-terminal -- it sets the type of a non-terminal that is defined elsewhere. Some versions of bison give you a warning for a %type with an undefined non-terminal, but others just ignore it.

You define a non-terminal by giving a rule with the non-terminal on the left side (before the : ).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM