can look flex’s states function
http://aquamentus.com/flex_bison.html
http://comsci.liu.edu/~murali/lexyacc/Content.htm
http://www.mactech.com/articles/mactech/Vol.16/16.07/UsingFlexandBison/index.html
http://userpages.monmouth.com/~wstreett/lex-yacc/flex_1.html