-
-
[原创]一个功能简单的词法分析
-
发表于:
2012-12-23 22:03
3463
-
这份代码保留好久了,这次比上次那个词法分析写的好一点了,实现的功能比上次多一点(只是多那么一点点
),当时想起来可简单了,写的时候才发现实现往往比想法困难(
),因为语法分析还不会写,所以基本上算没有语法分析的功能(
),有一些小语法分析功能,比如枚举体检测(
);代码先暂且搁置到这里,等日后功夫到家了,再来补全(
)。这是一些简单的范例,也只能跑这些简单的范例(
)。
跑出来的日志(见example.zip):
identifiers:stdio--len:5 Fri Dec 07 01:29:34 2012
identifiers:global--len:6 Fri Dec 07 01:29:34 2012
identifiers:g_name--len:6 Fri Dec 07 01:29:34 2012
string sequence:hello,welcome study hely language Fri Dec 07 01:29:34 2012
identifiers:count--len:5 Fri Dec 07 01:29:34 2012
identifiers:index--len:5 Fri Dec 07 01:29:34 2012
identifiers:size--len:4 Fri Dec 07 01:29:34 2012
identifiers:total--len:5 Fri Dec 07 01:29:34 2012
decimal-constant:123 Fri Dec 07 01:29:34 2012
identifiers:i--len:1 Fri Dec 07 01:29:34 2012
identifiers:index--len:5 Fri Dec 07 01:29:34 2012
identifiers:i--len:1 Fri Dec 07 01:29:34 2012
identifiers:size--len:4 Fri Dec 07 01:29:34 2012
identifiers:i--len:1 Fri Dec 07 01:29:34 2012
identifiers:total--len:5 Fri Dec 07 01:29:34 2012
identifiers:i--len:1 Fri Dec 07 01:29:34 2012
identifiers:count--len:5 Fri Dec 07 01:29:34 2012
identifiers:main--len:4 Fri Dec 07 01:29:34 2012
identifiers:argc--len:4 Fri Dec 07 01:29:34 2012
identifiers:argv--len:4 Fri Dec 07 01:29:34 2012
identifiers:total--len:5 Fri Dec 07 01:29:34 2012
identifiers:count--len:5 Fri Dec 07 01:29:34 2012
decimal-constant:1 Fri Dec 07 01:29:34 2012
decimal-constant:1000 Fri Dec 07 01:29:34 2012
identifiers:total--len:5 Fri Dec 07 01:29:34 2012
decimal-constant:1000 Fri Dec 07 01:29:34 2012
identifiers:stdio--len:5 Fri Dec 07 01:29:34 2012
identifiers:printf--len:6 Fri Dec 07 01:29:34 2012
string sequence:total < 1000 Fri Dec 07 01:29:34 2012
identifiers:stdio--len:5 Fri Dec 07 01:29:34 2012
identifiers:printf--len:6 Fri Dec 07 01:29:34 2012
string sequence:%s--%d Fri Dec 07 01:29:34 2012
identifiers:g_name--len:6 Fri Dec 07 01:29:34 2012
identifiers:total--len:5 Fri Dec 07 01:29:34 2012
identifiers:main--len:4 Fri Dec 07 01:29:34 2012
[招生]科锐逆向工程师培训(2024年11月15日实地,远程教学同时开班, 第51期)