I'm writing a grammar using Flex++ to generate a parser and this block of code always returns an "unrecognized rule" error.
%{
#include "Parserbase.h"
%}
%option noyywrap
num [0-9]+
float [0-9]+"."[0-9]+
comment [["//"[.]*\n] | ["/\*"[.]*"\*/"]]
varname [a-zA-Z][a-zA-Z0-9_]*
%%
";" {return ParserBase::SEMICOLON;}
"\n" {return ParserBase::ENDLINE;}
"int" {return ParserBase::INT;}
"=" {return ParserBase::EQUALS;}
{num} {return ParserBase::NUM;}
{comment} {return ParserBase::COMMENT;}
{varname} {return ParserBase::VARNAME;}
This always returns the following :
bisonc++ Compiler.y
[Warning] Terminal symbol(s) not used in productions:
257: NUM
261: ENDLINE
g++ -c parse.cc
flex++ Compiler.l
Compiler.l:21: unrecognised rule
make: *** [lex.yy.cc] Error 1
I've tried moving around the rules, changing the alias to a simple [a-zA-Z] or even just [a-z] All to no avail, and it's driving me mad... Anyone got any ideas? Thanks!