word.l
来自「语法分析 语法分析」· L 代码 · 共 84 行
L
84 行
%{{* 下面的例子改编自lex和yacc第二版 识别更多的话 *} program IsVerb;{$APPTYPE CONSOLE}uses SysUtils, LexLib;%}%%[\t ]+ {* 忽略空格 *} ;is |am |are |were |was |be |being |been |do |does |did |will |would |should |can |could |has |have |had |go writeln(format('%s是动词', [yytext])); very |simply |gently |quietly |calmly |angrily writeln(format('%s是副词', [yytext])); to |from |behind |above |below |between |below writeln(format('%s是介词', [yytext])); if |then |and |but |or writeln(format('%s是连词', [yytext])); their |my |your |his |her |its writeln(format('%s是形容词', [yytext])); I |you |he |she |we |they writeln(format('%s是代词', [yytext])); [a-zA-Z]+ writeln(format('%s无法识别', [yytext])); \&.|\n ECHO; {* 其它 */ }%%begin yylex;end.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?