亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? kwtbl.pas

?? YACC和LEX的資料書籍 以及一些源碼 很有幫助
?? PAS
字號:

(* KWTBL - prepare keyword tables for use in lexical analyzers

   USAGE: kwtbl [<input-file] [>output-file]

   DESCRIPTION

   KWTBL is a tiny utility that helps you prepare keyword tables for use
   in lexical analyzers, such as yylex routines prepared with the TP Lex
   program.

   In languages with a large number of keywords it is often more efficient
   to analyze the reserved words using a general pattern, and then use a
   table lookup procedure to determine the actual code for the keyword.
   Also, large keyword tables in a Lex grammar can easily cause TP Lex to
   overflow; in such cases the KWTBL utility is useful.

   KWTBL reads in a list of (keyword, code) pairs, sorts keywords alpha-
   betically, and writes out two typed array constants, one containing
   the keyword strings and the other containing the corresponding codes.
   These tables may be accessed through a binary table lookup procedure
   which is appended to the end of the output file. The code for the
   table lookup procedure is assumed to be in the file 'KWTBL.COD' which
   must be present either in the current directory or in the directory
   from which KWTBL was executed; without this file, KWTBL does not
   generate the table lookup procedure.

   Consider a typical programming language with identifiers and certain
   reserved words which look like identifiers. The corresponding rules
   of your TP Lex program might look like:

   if		return( _IF_ );
   while	return( _WHILE_ );
   ...
   [A-Za-z]+	return( ID );

   Alternatively, you can use KWTBL to produce a keyword table lookup
   procedure. The input to KWTBL will be something like:

   if		_IF_
   while	_WHILE_
   ...

   Each keyword entry is on a separate line, and keyword and corresponding
   code are separated by whitespace (blanks and/or tabs). Empty lines are
   ignored. You do not have to sort the keyword entries; KWTBL will do that
   for you. The code for a keyword can actually be any character sequence
   which denotes a legal constant integer expression.

   From the keyword table, KWTBL produces two typed array constants:

   const

   nkws = ...;   { number of different keywords }
   kwsize = ...; { maximum size of keywords }

   kwtbl : array [ 1..nkws ] of String[ kwsize ] = (
     ..., 'if', ..., 'while', ...
   );

   kwcod : array [ 1..nkws ] of Integer = (
     ..., _IF_, ..., _WHILE_, ...
   );

   These tables may be accessed through the table lookup procedure (named
   kwlookup in the standard version of the KWTBL.COD file). The corresponding
   Lex code will now be:

   [A-Za-z]+	if kwlookup( yytext, code ) then
   		  return( code )
                else
                  return( ID );
*)

uses Dos;

(* Quicksort: *)

type

OrderPredicate = function (i, j : Integer) : Boolean;
SwapProc = procedure (i, j : Integer);

procedure quicksort(lo, hi: Integer;
                    less : OrderPredicate;
                    swap : SwapProc);
  (* derived from the quicksort routine in QSORT.PAS in the Turbo Pascal
     distribution *)
  procedure sort(l, r: Integer);
    var i, j, k : Integer;
    begin
      i := l; j := r; k := (l+r) DIV 2;
      repeat
        while less(i, k) do inc(i);
        while less(k, j) do dec(j);
        if i<=j then
          begin
            swap(i, j);
            if k=i then k := j (* pivot element swapped! *)
            else if k=j then k := i;
            inc(i); dec(j);
          end;
      until i>j;
      if l<j then sort(l,j);
      if i<r then sort(i,r);
    end(*sort*);
  begin
    if lo<hi then sort(lo,hi);
  end(*quicksort*);

const

maxkws = 100;	 (* maximum number of keywords *)
maxkwsize = 40;	 (* maximum keyword size; longer keywords are truncated *)
maxcodsize = 40; (* maximum code size; longer keyword codes are truncated *)

type

KwString = String[ maxkwsize ];
CodString = String [ maxcodsize ];

var

(* the keyword table: *)

nkws, kwsize : Integer;

kwtbl : array [ 1..maxkws ] of KwString;
kwcod : array [ 1..maxkws ] of CodString;

var stderr : Text;

procedure error( msg : String );
  (* write out an error message *)
  begin
    writeln( stderr, '*** ', msg );
  end(*error*);

procedure fatal( msg : String );
  (* write error message and halt program *)
  begin
    error( 'fatal: '+msg );
    halt ( 1 );
  end(*fatal*);

procedure split( line : String; var kw : KwString; var cod : CodString );
  (* split a line in keyword and code part *)
  const tab = ^I;
  var i : Integer;
  begin
    kw := ''; i := 1;
    while (i<=length(line)) and (line[i]<>' ') and (line[i]<>tab) do
      begin
        if length(kw)<maxkwsize then kw := kw+line[i];
        inc(i);
      end;
    while (i<=length(line)) and ((line[i]=' ') or (line[i]=tab)) do inc(i);
    cod := copy( line, i, length(line) );
  end(*split*);

function path( filename : String ) : String;
  (* return the drive/directory part of a filename *)
  var d : DirStr; n : NameStr; e : ExtStr;
  begin
    fsplit( filename, d, n, e );
    path := d;
  end(*path*);

function intStr( i : Integer ) : String;
  (* convert an integer to a string *)
  var s : String;
  begin
    Str( i, s );
    intStr := s;
  end(*intStr*);

(* Routines to sort the keyword table: *)

{$F+}
function less( i, j : Integer ) : Boolean;
  begin
    less := kwtbl[i]<kwtbl[j];
  end(*less*);
procedure swap( i, j : Integer );
  var kw : KwString; cod : CodString;
  begin
    kw := kwtbl[i]; cod := kwcod[i];
    kwtbl[i] := kwtbl[j]; kwcod[i] := kwcod[j];
    kwtbl[j] := kw; kwcod[j] := cod;
  end(*swap*);
{$F-}

var line : String; i, lineno, actcol : Integer; codfile : Text;

begin
  (* open stderr device: *)
  assign( stderr, '' ); rewrite( stderr );
  TextRec(stderr).handle := 2;
  TextRec(stderr).bufSize := 1;
  (* read in the keyword table from standard input: *)
  nkws := 0; kwsize := 0; lineno := 0;
  while not eof do
    begin
      readln( line ); inc( lineno );
      if line<>'' then
        begin
          inc( nkws );
          if nkws>maxkws then fatal( 'too many keywords' );
          split( line, kwtbl[ nkws ], kwcod[ nkws ] );
          if ( kwtbl[ nkws ]='' ) or ( kwcod[ nkws ] = '' ) then
            begin
              error( 'error in line '+intStr( lineno ) );
              dec( nkws );
            end
	  else if length(kwtbl[nkws])>kwsize then
	    kwsize := length(kwtbl[nkws]);
        end;
    end;
  (* sort the keyword table: *)
  quicksort( 1, nkws, less, swap );
  (* produce output code: *)
  if nkws=0 then fatal( 'nothing to do' );
  writeln;
  writeln( 'const' );
  writeln;
  writeln('nkws = ', nkws, ';' );
  writeln('kwsize = ', kwsize, ';' );
  writeln;
  writeln('kwtbl : array [ 1..nkws ] of String[ kwsize ] = (' );
  write( '  ' ); actcol := 3;
  for i := 1 to nkws do
    begin
      if actcol+length(kwtbl[i])>79 then
        begin
          writeln; write( '  ' ); actcol := 3;
        end;
      write( '''', kwtbl[i], '''' ); inc( actcol, length( kwtbl[i] )+2 );
      if i<nkws then
        begin
          write( ', ' ); inc( actcol, 2 );
        end;
    end;
  writeln;
  writeln( ');' );
  writeln;
  writeln('kwcod : array [ 1..nkws ] of Integer = (' );
  write( '  ' ); actcol := 3;
  for i := 1 to nkws do
    begin
      if actcol+length(kwcod[i])>79 then
        begin
          writeln; write( '  ' ); actcol := 3;
        end;
      write( kwcod[i] ); inc( actcol, length( kwcod[i] ) );
      if i<nkws then
        begin
          write( ', ' ); inc( actcol, 2 );
        end;
    end;
  writeln;
  writeln( ');' );
  writeln;
  (* copy KWTBL.COD file to the output: *)
  {$I-}
  assign( codfile, 'KWTBL.COD' ); reset( codfile );
  if ioresult<>0 then
    begin
      assign( codfile, path( paramStr(0) )+'KWTBL.COD' ); reset( codfile );
      if ioresult<>0 then halt;
    end;
  while not eof( codfile ) do
    begin
      readln( codfile, line );
      writeln( line );
    end;
  close( codfile );
end.

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲精品成人少妇| 国产做a爰片久久毛片| 久久精品国产99国产精品| 成人h版在线观看| 日韩欧美一二三| 亚洲精品国产无天堂网2021| 国产成人精品一区二| 91精品国产色综合久久不卡电影 | 国产日韩欧美综合一区| 亚洲一区二区三区视频在线播放| 国产精品系列在线观看| 日韩免费成人网| 日韩精品91亚洲二区在线观看 | caoporm超碰国产精品| 欧美mv日韩mv国产| 五月激情综合色| 欧美在线制服丝袜| 亚洲色图视频免费播放| 国产成人综合在线观看| 久久夜色精品一区| 国产九色精品成人porny| 欧美xxxxxxxxx| 免费观看成人av| 日韩一二三四区| 免费观看一级特黄欧美大片| 欧美日韩国产在线观看| 亚洲伊人色欲综合网| 色婷婷精品久久二区二区蜜臀av| 国产精品卡一卡二| 成人高清视频在线观看| 中文欧美字幕免费| 成人免费av网站| 中文字幕日韩av资源站| 成人永久看片免费视频天堂| 欧美高清在线一区二区| 成a人片国产精品| 亚洲视频你懂的| 色婷婷综合久久久中文字幕| 一区二区三区小说| 欧美日韩一级二级| 日本欧美肥老太交大片| 精品国产青草久久久久福利| 另类小说欧美激情| 国产偷国产偷精品高清尤物| 国产激情91久久精品导航 | 性欧美疯狂xxxxbbbb| 欧美一区国产二区| 国产一区二区三区久久悠悠色av | 一级精品视频在线观看宜春院| 91麻豆免费视频| 亚洲一区二区偷拍精品| 欧美一区二区三区四区视频| 国产一区二区在线影院| 国产精品久久国产精麻豆99网站| 日本道在线观看一区二区| 午夜精品123| 久久男人中文字幕资源站| 99久久综合99久久综合网站| 亚洲一区二区三区四区五区黄| 欧美一级一区二区| 成人精品视频一区二区三区| 亚洲一二三四在线观看| 精品剧情在线观看| 国产福利一区在线观看| 亚洲卡通欧美制服中文| 欧美一级欧美一级在线播放| av在线免费不卡| 免费在线观看成人| 亚洲少妇中出一区| 日韩一区二区三区在线| 成人免费看黄yyy456| 日韩不卡一区二区| 亚洲欧美一区二区视频| 国产精品日产欧美久久久久| 欧美午夜不卡视频| 国产成人免费视频精品含羞草妖精| 亚洲精品久久久久久国产精华液| 欧美mv日韩mv国产网站| 欧美三级视频在线| 国产成人av自拍| 日本中文字幕不卡| 一区二区三区av电影| 国产亚洲一二三区| 3d动漫精品啪啪一区二区竹菊| av亚洲精华国产精华| 国产一区二区三区国产| 亚洲国产另类精品专区| 国产精品电影一区二区三区| 亚洲精品一区二区三区福利| 欧美日韩在线综合| 色综合久久久久综合| 国产精品1024| 麻豆91在线观看| 婷婷丁香久久五月婷婷| 一区二区三区欧美久久| 亚洲手机成人高清视频| 国产欧美日韩视频在线观看| 精品少妇一区二区三区日产乱码| 日本久久电影网| 97久久精品人人做人人爽| 国产福利一区在线观看| 国产精品亚洲专一区二区三区| 日本一不卡视频| 男女性色大片免费观看一区二区 | 亚洲一区在线观看免费| 亚洲色图20p| 亚洲欧洲日韩av| 国产精品三级视频| 国产精品你懂的在线欣赏| 国产色一区二区| 久久久午夜精品理论片中文字幕| 精品精品欲导航| 久久综合久久综合久久综合| 日韩精品一区二区三区四区| 欧美一区二区啪啪| 欧美成人video| 日韩欧美成人一区二区| 91精品国产91综合久久蜜臀| 欧美一区二区三区视频在线| 欧美大片在线观看一区二区| 精品99一区二区| 久久久精品tv| 国产精品黄色在线观看| 亚洲激情图片一区| 日日骚欧美日韩| 麻豆国产精品一区二区三区| 精品写真视频在线观看| 国产乱对白刺激视频不卡 | 国产真实精品久久二三区| 久久丁香综合五月国产三级网站| 麻豆精品国产传媒mv男同| 国产精品88av| 日本道精品一区二区三区| 欧美三级日本三级少妇99| 日韩一区二区在线观看视频| 精品国产91乱码一区二区三区| 久久一区二区视频| 亚洲欧美日韩国产一区二区三区| 亚洲成精国产精品女| 久久99久久99小草精品免视看| 国产黄色精品网站| 欧美性三三影院| 久久久蜜臀国产一区二区| 亚洲免费三区一区二区| 青青草97国产精品免费观看无弹窗版 | 中文字幕中文乱码欧美一区二区| 亚洲欧美偷拍另类a∨色屁股| 天天免费综合色| 国产福利精品导航| 欧美男人的天堂一二区| 国产午夜精品福利| 三级在线观看一区二区 | 国产精品久久久久一区二区三区 | 国产欧美精品日韩区二区麻豆天美| 亚洲欧美一区二区久久| 久久99九九99精品| 欧美手机在线视频| 中文字幕精品在线不卡| 午夜a成v人精品| 波多野结衣亚洲| 欧美va亚洲va香蕉在线| 亚洲一区自拍偷拍| 不卡大黄网站免费看| 日韩三级免费观看| 亚洲国产精品久久人人爱蜜臀| 国产中文字幕一区| 欧美一区二区三区色| 亚洲综合一区在线| jlzzjlzz欧美大全| www国产成人| 婷婷成人综合网| 欧美最猛黑人xxxxx猛交| 国产性天天综合网| 狠狠色伊人亚洲综合成人| 欧美日韩性生活| 一区二区三区在线看| 不卡的av网站| 国产欧美一区二区三区在线老狼 | 婷婷久久综合九色综合绿巨人 | 一区二区三区中文字幕精品精品| 韩国av一区二区| 日韩三级视频在线看| 日韩在线一区二区三区| 欧美日韩精品三区| 亚洲国产成人av网| 欧美午夜精品一区二区三区| 亚洲美女免费视频| thepron国产精品| 亚洲欧洲精品天堂一级| 成人激情免费电影网址| 久久精品日韩一区二区三区| 美女视频黄频大全不卡视频在线播放| 欧美视频你懂的| 亚洲国产欧美另类丝袜| 91国产视频在线观看| 亚洲乱码国产乱码精品精可以看 | 久久综合久久综合亚洲| 精品系列免费在线观看| 久久亚洲二区三区| 国产一区二区精品久久99|