⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mylexer.l

📁 词法分析
💻 L
字号:
%{
/****************************************************************************
exp01.l
ParserWizard generated Lex file.

Date: 2008年5月8日
****************************************************************************/
#include "stdio.h"

%}

/////////////////////////////////////////////////////////////////////////////
// declarations section

// place any declarations here 
// word count
// char count
// line count
 int wcount=0;   
 int ccount=0;    
 int lcount=1;    
%%
[A-Za-z0-9]+ { wcount++; ccount += yyleng; }
\n {lcount++;ccount++;}
. ccount++;

/////////////////////////////////////////////////////////////////////////////
// rules section

// place your Lex rules here

%%

/////////////////////////////////////////////////////////////////////////////
// programs section
int main(void)
{
 yylex();
 printf("in this file , there are : \n %d chars %d words %d lines ",ccount,wcount,lcount);
 return yywrap();
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -