编写Lex 的模式匹配规则时,模式和模式匹配后的动作的中括号要在同一行
字数统计程序中的 Lex 规则
这么写是错了
{words}
{ wordCount++; /* increase the word count by one*/ } {whitespace}
{ /* do nothing*/ } {numbers}
{ /* one may want to add some processing here*/ } %%正确的写法是:
{words} { wordCount++; /* increase the word count by one*/ } {whitespace} { /* do nothing*/ } {numbers} { /* one may want to add some processing here*/ } %%