Le 4 oct. 2013 à 15:35, Markus Elfring <markus.elfr...@web.de> a écrit :
>>> - Is a conversion possible without the specification of a specific data >>> type in >>> a directive like "%token"? >> >> I'm not sure to understand what you mean. If '0' is expected >> to have a value, then you should declare it > > I added also the rule '. { return yy::my_parser::make_SINGLE_CHARACTER(yytext, > loc); }' and the specification '%token <std::string> SINGLE_CHARACTER > "uncategorised_character"' to my source file settings in the meantime. > Unfortunately, I stumble on the message "lexer.l:36: warning, rule cannot be > matched". > https://sourceforge.net/p/flex/bugs/161/ It makes plenty of sense to me that that "rule cannot be matched", it is not a bug in Flex. Your file, stripped down: ws [ \n\a\b\f\r\t\v] id [^.=\ \n\a\b\f\r\t\v] %% {ws}+ { return yy::my_parser::make_SEPARATION(yytext, loc); } {id}+ { return yy::my_parser::make_IDENTIFIER(yytext, loc); } = { return yy::my_parser::make_ASSIGN(loc); } "." { Return yy::my_parser::make_DOT(loc); } . { return yy::my_parser::make_SINGLE_CHARACTER(yytext, loc); } <<EOF>> { return yy::my_parser::make_END(loc); } Note that {ws} + '.' + '=' is exactly the converse of {id}, so there is nothing else to match. It's weird that SINGLE_CHARACTER is taking a char* instead of a char (i.e., I expect to see '*yytext', not 'yytext' there). >>> I would like to avoid >>> the repetition of similar actions behind them. It would be more >>> "convenient" to >>> choose a different default action for selected rules, wouldn't it? >> >> One usually does not need that, as this kind of job is typically >> left to the scanner/lexer, not to the parser. > > I am also thinking about a design approach with a scannerless parser like the > way it is provided by the class library "Spirit". > http://stackoverflow.com/questions/2224373/scannerless-parser-generators Scannerless is a fine idea, however I fear that with Bison you'll get bad performances. Please, keep us posted. _______________________________________________ help-bison@gnu.org https://lists.gnu.org/mailman/listinfo/help-bison