标签:conflict htm get lock describes block could represent item
yyparse() returns a value of 0 if the input it parses is valid according to the given grammar rules.
It returns a 1 if the input is incorrect and error recovery is impossible.
yyparse() does not do its own lexical analysis. In other words, it does not pull the input apart into tokens ready for parsing.
Instead, it calls a routine called yylex() everytime it wants to obtain a token from the input.
yylex() returns a value indicating the type of token that has been obtained.
If the token has an actual value, this value (or some representation of the value, for example, a pointer to a string containing the value) is returned in an external variable named yylval.
It is up to the user to write a yylex() routine that breaks the input into tokens and returns the tokens one by one to yyparse().
See Function section for more information on the lexical analyzer.
How yacc works
The input to yacc describes the rules of a grammar. yacc uses these rules to produce the source code for a program that parses the grammar.
You can then compile this source code to obtain a program that reads input, parses it according to the grammar, and takes action based on the result.
The source code produced by yacc is written in the C programming language. It consists of a number of data tables that represent the grammar, plus a C function named yyparse().
By default, yacc symbol names used begin with yy. This is an historical convention, dating back to yacc‘s predecessor, UNIX yacc.
You can avoid conflicts with yacc names by avoiding symbols that start with yy.
%prefix prefix
at the beginning of the yacc input. For example:
%prefix ww
asks for a prefix of ww instead of yy. Alternatively, you could specify -p ww on the lex command line. 标签:conflict htm get lock describes block could represent item
原文地址:https://www.cnblogs.com/cpsmile/p/9074009.html