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

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

?? tutor12.doc

?? 計算機編譯原理教材
?? DOC
?? 第 1 頁 / 共 3 頁
字號:





       like  the semicolon, each item of sugar  is  something  that  can
       potentially cause a compile error by its omission.


       DEALING WITH SEMICOLONS

       There  are  two  distinct  ways  in which semicolons are used  in
       popular  languages.    In Pascal, the semicolon is regarded as an
       statement SEPARATOR.  No semicolon  is  required  after  the last
       statement in a block.  The syntax is:


            <block> ::= <statement> ( ';' <statement>)*

            <statement> ::= <assignment> | <if> | <while> ... | null


       (The null statement is IMPORTANT!)

       Pascal  also defines some semicolons in  other  places,  such  as
       after the PROGRAM statement.

       In  C  and  Ada, on the other hand, the semicolon is considered a
       statement TERMINATOR,  and  follows  all  statements  (with  some
       embarrassing and confusing  exceptions).   The syntax for this is
       simply:


            <block> ::= ( <statement> ';')*


       Of  the two syntaxes, the Pascal one seems on the face of it more
       rational, but experience has shown  that it leads to some strange
       difficulties.  People get  so  used  to  typing a semicolon after
       every  statement  that  they tend to  type  one  after  the  last
       statement in a block, also.  That usually doesn't cause  any harm
       ...  it  just gets treated as a  null  statement.    Many  Pascal
       programmers, including yours truly,  do  just  that. But there is
       one  place you absolutely CANNOT type  a  semicolon,  and  that's
       right before an ELSE.  This little gotcha  has  cost  me  many an
       extra  compilation,  particularly  when  the  ELSE  is  added  to
       existing code.    So  the  C/Ada  choice  turns out to be better.
       Apparently Nicklaus Wirth thinks so, too:  In his  Modula  2,  he
       abandoned the Pascal approach.

       Given either of these two syntaxes, it's an easy matter (now that
       we've  reorganized  the  parser!) to add these  features  to  our
       parser.  Let's take the last case first, since it's simpler.

       To begin, I've made things easy by introducing a new recognizer:


       {--------------------------------------------------------------}
       { Match a Semicolon }A*2A*
                                     - 6 -

PA2A





       procedure Semi;
       begin
          MatchString(';');
       end;
       {--------------------------------------------------------------}


       This procedure works very much like our old Match.  It insists on
       finding a semicolon as the next token.  Having found it, it skips
       to the next one.

       Since a  semicolon follows a statement, procedure Block is almost
       the only one we need to change:


       {--------------------------------------------------------------}
       { Parse and Translate a Block of Statements }

       procedure Block;
       begin
          Scan;
          while not(Token in ['e', 'l']) do begin
             case Token of
              'i': DoIf;
              'w': DoWhile;
              'R': DoRead;
              'W': DoWrite;
              'x': Assignment;
             end;
             Semi;
             Scan;
          end;
       end;
       {--------------------------------------------------------------}


       Note carefully the subtle change in the case statement.  The call
       to  Assignment  is now guarded by a test on Token.   This  is  to
       avoid calling Assignment when the  token  is  a  semicolon (which
       could happen if the statement is null).

       Since declarations are also  statements,  we  also  need to add a
       call to Semi within procedure TopDecls:


       {--------------------------------------------------------------}
       { Parse and Translate Global Declarations }

       procedure TopDecls;
       begin
          Scan;
          while Token = 'v' do begin
             Alloc;
             while Token = ',' doA*2A*
                                     - 7 -

PA2A





                Alloc;
             Semi;
          end;
       end;
       {--------------------------------------------------------------}


       Finally, we need one for the PROGRAM statement:


       {--------------------------------------------------------------}
       { Main Program }

       begin
          Init;
          MatchString('PROGRAM');
          Semi;
          Header;
          TopDecls;
          MatchString('BEGIN');
          Prolog;
          Block;
          MatchString('END');
          Epilog;
       end.
       {--------------------------------------------------------------}


       It's as easy as that.  Try it with a copy of TINY and see how you
       like it.

       The Pascal version  is  a  little  trickier,  but  it  still only
       requires  minor  changes,  and those only to procedure Block.  To
       keep things as simple as possible, let's split the procedure into
       two parts.  The following procedure handles just one statement:


       {--------------------------------------------------------------}
       { Parse and Translate a Single Statement }

       procedure Statement;
       begin
          Scan;
          case Token of
           'i': DoIf;
           'w': DoWhile;
           'R': DoRead;
           'W': DoWrite;
           'x': Assignment;
          end;
       end;
       {--------------------------------------------------------------}AB2AB
                                     - 8 -A*2A*

PA2A





       Using this procedure, we can now rewrite Block like this:


       {--------------------------------------------------------------}
       { Parse and Translate a Block of Statements }

       procedure Block;
       begin
          Statement;
          while Token = ';' do begin
             Next;
             Statement;
          end;
       end;
       {--------------------------------------------------------------}


       That  sure  didn't  hurt, did it?  We can now parse semicolons in
       Pascal-like fashion.


       A COMPROMISE

       Now that we know how to deal with semicolons, does that mean that
       I'm going to put them in KISS/TINY?  Well, yes and  no.    I like
       the extra sugar and the security that comes with knowing for sure
       where the  ends  of  statements  are.    But I haven't changed my
       dislike for the compilation errors associated with semicolons.

       So I have what I think is a nice compromise: Make them OPTIONAL!

       Consider the following version of Semi:


       {--------------------------------------------------------------}
       { Match a Semicolon }

       procedure Semi;
       begin
          if Token = ';' then Next;
       end;
       {--------------------------------------------------------------}


       This procedure will ACCEPT a semicolon whenever it is called, but
       it won't INSIST on one.  That means that when  you  choose to use
       semicolons, the compiler  will  use the extra information to help
       keep itself on track.  But if you omit one (or omit them all) the
       compiler won't complain.  The best of both worlds.

       Put this procedure in place in the first version of  your program
       (the  one for C/Ada syntax), and you have  the  makings  of  TINY
       Version 1.2.A62A6
                                     - 9 -A*2A*

PA2A





       COMMENTS

       Up  until  now  I have carefully avoided the subject of comments.
       You would think that this would be an easy subject ... after all,
       the compiler doesn't have to deal with comments at all; it should
       just ignore them.  Well, sometimes that's true.

       Comments can be just about as easy or as difficult as  you choose
       to make them.    At  one  extreme,  we can arrange things so that
       comments  are  intercepted  almost  the  instant  they  enter the
       compiler.  At the  other,  we can treat them as lexical elements.
       Things  tend to get interesting when  you  consider  things  like
       comment delimiters contained in quoted strings.


       SINGLE-CHARACTER DELIMITERS

       Here's an example.  Suppose we assume the  Turbo  Pascal standard
       and use curly braces for comments.  In this case we  have single-
       character delimiters, so our parsing is a little easier.

       One  approach  is  to  strip  the  comments  out the  instant  we
       encounter them in the input stream; that is,  right  in procedure
       GetChar.    To  do  this,  first  change  the  name of GetChar to
       something else, say GetCharX.  (For the record, this is  going to
       be a TEMPORARY change, so best not do this with your only copy of
       TINY.  I assume you understand that you should  always  do  these
       experiments with a working copy.)

       Now, we're going to need a  procedure  to skip over comments.  So
       key in the following one:


       {--------------------------------------------------------------}
       { Skip A Comment Field }

       procedure SkipComment;
       begin
          while Look <> '}' do
             GetCharX;
          GetCharX;
       end;
       {--------------------------------------------------------------}


       Clearly, what this procedure is going to do is to simply read and
       discard characters from the input  stream, until it finds a right
       curly brace.  Then it reads one more character and returns  it in
       Look.

       Now we can  write  a  new  version of GetChar that SkipComment to
       strip out comments:AB2AB
                                    - 10 -A*2A*

PA2A





       {--------------------------------------------------------------}
       { Get Character from Input Stream }
       { Skip Any Comments }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美丰满美乳xxx高潮www| 国产在线精品一区在线观看麻豆| 播五月开心婷婷综合| 中文字幕免费观看一区| 成人av高清在线| 夜夜嗨av一区二区三区四季av| 91免费视频观看| 亚洲一二三四区| 91精品国产91久久久久久最新毛片| 丝袜美腿亚洲综合| 久久亚洲二区三区| 成人精品免费网站| 亚洲一本大道在线| 欧美一区二区三区人| 国产高清在线精品| 亚洲一区av在线| 精品国产三级电影在线观看| 岛国一区二区在线观看| 亚洲最大成人综合| 久久久久久久久伊人| 国产精品久久久久国产精品日日| 色综合中文字幕| 日韩电影在线免费观看| 欧美经典一区二区三区| 欧美性猛片aaaaaaa做受| 黄网站免费久久| 亚洲日本在线a| 精品久久久久香蕉网| 91一区二区三区在线观看| 日韩电影免费一区| 国产精品人妖ts系列视频| 欧美日韩免费观看一区二区三区| 久久99精品一区二区三区| ...av二区三区久久精品| 欧美一区二区日韩一区二区| 成人黄色777网| 蜜臀久久久99精品久久久久久| 国产精品视频麻豆| 日韩欧美一二区| 在线观看不卡一区| 国产91露脸合集magnet | 精品国产3级a| 91污片在线观看| 国产精品小仙女| 日本欧美久久久久免费播放网| 国产精品电影一区二区| 91精品国产综合久久久久久久久久 | 欧美日韩一区不卡| 国产**成人网毛片九色| 蜜桃视频在线观看一区二区| 亚洲黄色片在线观看| 国产日本亚洲高清| 精品久久久影院| 日韩欧美中文一区| 欧美日韩视频一区二区| 97精品国产97久久久久久久久久久久| 国内久久婷婷综合| 日本va欧美va欧美va精品| 一区二区三区影院| 最新高清无码专区| 国产精品美女一区二区在线观看| 日韩欧美国产综合在线一区二区三区| 色94色欧美sute亚洲线路一ni| 成人av资源网站| 粉嫩高潮美女一区二区三区| 久久99久久久久| 青青青伊人色综合久久| 午夜欧美大尺度福利影院在线看| 综合av第一页| 亚洲视频在线一区| 亚洲欧美偷拍另类a∨色屁股| 中文字幕在线不卡一区| 国产日产欧产精品推荐色 | 粉嫩一区二区三区在线看 | 成人av高清在线| 成人黄色小视频| 99久久婷婷国产| 色综合久久综合中文综合网| a美女胸又www黄视频久久| 成a人片国产精品| www.66久久| 一本大道综合伊人精品热热 | 精品在线一区二区三区| 久久国产人妖系列| 国产麻豆精品在线观看| 国产91精品一区二区麻豆网站| 久久免费美女视频| 久久久www免费人成精品| 久久久久久久久久久黄色| 国产欧美日韩三级| 亚洲色图在线播放| 亚洲第一福利视频在线| 奇米影视在线99精品| 激情五月播播久久久精品| 国产精品一区在线| 99精品热视频| 欧美日韩精品系列| 欧美mv日韩mv| 国产精品―色哟哟| 一区二区三区资源| 视频一区免费在线观看| 久草精品在线观看| 97久久超碰国产精品| 欧美日韩情趣电影| 久久久精品tv| 亚洲线精品一区二区三区八戒| 日韩激情av在线| 国产精品综合在线视频| 91成人在线免费观看| 日韩欧美aaaaaa| 国产精品三级在线观看| 午夜精品一区二区三区免费视频| 精品中文字幕一区二区小辣椒| a在线播放不卡| 欧美一区二区三区喷汁尤物| 国产精品剧情在线亚洲| 亚洲v日本v欧美v久久精品| 国产美女av一区二区三区| 欧亚一区二区三区| 久久一日本道色综合| 一区二区三区在线看| 韩国一区二区三区| 色老综合老女人久久久| 26uuu另类欧美| 亚洲电影在线免费观看| 成人午夜精品在线| 欧美一区二区三区日韩视频| 一区二区中文字幕在线| 毛片一区二区三区| 在线视频中文字幕一区二区| xnxx国产精品| 三级在线观看一区二区 | 亚洲一区二区三区自拍| 国产一区二区三区不卡在线观看 | 国产亚洲欧美在线| 蜜臀av性久久久久蜜臀aⅴ四虎 | 中文字幕一区二区不卡| 麻豆国产精品视频| 欧美日韩中文字幕一区二区| 国产精品日产欧美久久久久| 麻豆国产欧美日韩综合精品二区| 日本丰满少妇一区二区三区| 日本一区二区三区四区在线视频 | 国产在线一区观看| 亚洲一区在线观看视频| a在线播放不卡| 日本一区二区三区dvd视频在线| 美国毛片一区二区三区| 欧美二区三区的天堂| 夜夜嗨av一区二区三区| 一道本成人在线| 18涩涩午夜精品.www| 懂色av中文一区二区三区| 欧美精品一区二区三区在线播放 | 欧美视频一区二区| 亚洲精品伦理在线| 99久久久无码国产精品| 国产精品国产自产拍在线| 成人三级伦理片| 欧美韩国日本综合| 成人永久免费视频| 中文字幕欧美日韩一区| 成人一级片网址| 国产精品视频免费看| 成人黄色在线网站| 亚洲视频在线一区二区| 99精品欧美一区二区三区综合在线| 欧美激情在线看| av福利精品导航| 亚洲欧美欧美一区二区三区| 色哟哟精品一区| 亚洲高清中文字幕| 日韩一区国产二区欧美三区| 蜜桃免费网站一区二区三区| 日韩欧美www| 国产成人鲁色资源国产91色综| 久久午夜色播影院免费高清| 国产成人午夜精品影院观看视频 | 免费成人深夜小野草| 精品国产污污免费网站入口| 国产乱子伦一区二区三区国色天香| 国产亚洲一区字幕| av电影天堂一区二区在线观看| 亚洲男女一区二区三区| 欧美日韩一区在线观看| 日韩av中文在线观看| 日韩欧美一级特黄在线播放| 国产精品一区二区久激情瑜伽| 中文成人av在线| 欧美午夜在线一二页| 美日韩黄色大片| 中文字幕乱码一区二区免费| 色婷婷综合久久久中文一区二区| 天天操天天综合网| 久久精品日产第一区二区三区高清版 | 欧美激情一区二区三区| 91浏览器打开| 日本视频一区二区三区| 国产偷v国产偷v亚洲高清| 91极品美女在线|