欢迎来到天天文库
浏览记录
ID:49070296
大小:204.01 KB
页数:15页
时间:2020-02-27
《ANSI+C+grammar.doc》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、ANSICgrammar,LexspecificationIn1985,JeffLeepublishedthisLexspecificationtogetherwithaYaccgrammarfortheApril30,1985ANSICdraft. TomStockfischrepostedbothtonet.sourcesin1987;thatoriginal,asmentionedintheanswertoquestion17.25ofthecomp.lang.cFAQ,canbeftp'edfromftp.uu.net,fileusenet/net.sour
2、ces/ansi.c.grammar.Z.IintendtokeepthisversionasclosetothecurrentCStandardgrammaraspossible;pleaseletmeknowifyoudiscoverdiscrepancies.JuttaDegener,1995D[0-9]L[a-zA-Z_]H[a-fA-F0-9]E[Ee][+-]?{D}+FS(f
3、F
4、l
5、L)IS(u
6、U
7、l
8、L)*%{#include#include"y.tab.h"voidcount();%}%%"/*"{comment();}"au
9、to"{count();return(AUTO);}"break"{count();return(BREAK);}"case"{count();return(CASE);}"char"{count();return(CHAR);}"const"{count();return(CONST);}"continue"{count();return(CONTINUE);}"default"{count();return(DEFAULT);}"do"{count();return(DO);}"double"{count();return(DOUBLE);}"else"{cou
10、nt();return(ELSE);}"enum"{count();return(ENUM);}"extern"{count();return(EXTERN);}"float"{count();return(FLOAT);}15/15"for"{count();return(FOR);}"goto"{count();return(GOTO);}"if"{count();return(IF);}"int"{count();return(INT);}"long"{count();return(LONG);}"register"{count();return(REGIST
11、ER);}"return"{count();return(RETURN);}"short"{count();return(SHORT);}"signed"{count();return(SIGNED);}"sizeof"{count();return(SIZEOF);}"static"{count();return(STATIC);}"struct"{count();return(STRUCT);}"switch"{count();return(SWITCH);}"typedef"{count();return(TYPEDEF);}"union"{count();r
12、eturn(UNION);}"unsigned"{count();return(UNSIGNED);}"void"{count();return(VOID);}"volatile"{count();return(VOLATILE);}"while"{count();return(WHILE);}{L}({L}
13、{D})*{count();return(check_type());}0[xX]{H}+{IS}?{count();return(CONSTANT);}0{D}+{IS}?{count();return(CONSTANT);}{D}+{IS}?{count(
14、);return(CONSTANT);}L?'(\.
15、[^\'])+'{count();return(CONSTANT);}{D}+{E}{FS}?{count();return(CONSTANT);}{D}*"."{D}+({E})?{FS}?{count();return(CONSTANT);}{D}+"."{D}*({E})?{FS}?{count();return(CONSTANT);}L?"(\.
16、[^\"])*"{count();return(STRING_LITERAL);}"..."{count();return(ELLIPSIS);
此文档下载收益归作者所有
点击更多查看相关文章~~