词法分析器的输出是什么,该如何解决

词法分析器的输出是什么
一般是保存为什么形式的

------解决方案--------------------
C++ Tokens
A token is the smallest element of a C++ program that is meaningful to the compiler. The C++ parser recognizes these kinds of tokens: identifiers, keywords, literals, operators, punctuators, and other separators. A stream of these tokens makes up a translation unit.

Tokens are usually separated by “white space.” White space can be one or more: 

Blanks


Horizontal or vertical tabs


New lines


Formfeeds


Comments 
Syntax

token :

keyword
identifier
constant
operator
punctuator

preprocessing-token :

header-name
identifier
pp-number
character-constant
string-literal
operator
punctuator
each nonwhite-space character that cannot be one of the above

The parser separates tokens from the input stream by creating the longest token possible using the input characters in a left-to-right scan. Consider this code fragment:

a = i+++j;

The programmer who wrote the code might have intended either of these two statements:

a = i + (++j)

a = (i++) + j

Because the parser creates the longest token possible from the input stream, it chooses the second interpretation, making the tokens i++, +, and j.

------解决方案--------------------
lex&yacc时常用的表达式解析组合。
用lex编辑源代码,将源代码存储为a.l,然后用进行编译,输入flex a.l,编译后生成lex.yy.c(yy 指的是yacc)文件,用c编译器打开(确保example.txt存储在相同目录下),编译运行即可.
输出形式是token:<单词种别,单词符号的属性值>

词法分析器的输出是什么,该如何解决

参考:http://blog.****.net/xn4545945/article/details/8273499