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

? 歡迎來(lái)到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? tutor12.doc

?? 計(jì)算機(jī)編譯原理教材
?? DOC
?? 第 1 頁(yè) / 共 3 頁(yè)
字號(hào):
O
PA2A



























                            LET'S BUILD A COMPILER!

                                       By

                            Jack W. Crenshaw, Ph.D.

                                  5 June 1989


                              Part XII: MISCELLANY





























PA2A





       *****************************************************************
       *                                                               *
       *                        COPYRIGHT NOTICE                       *
       *                                                               *
       *   Copyright (C) 1989 Jack W. Crenshaw. All rights reserved.   *
       *                                                               *
       *****************************************************************


       INTRODUCTION

       This installment is another one  of  those  excursions  into side
       alleys  that  don't  seem to fit  into  the  mainstream  of  this
       tutorial  series.    As I mentioned last time, it was while I was
       writing this installment that I realized some changes  had  to be
       made  to  the  compiler structure.  So I had to digress from this
       digression long enough to develop the new structure  and  show it
       to you.

       Now that that's behind us, I can tell you what I  set  out  to in
       the first place.  This shouldn't  take  long, and then we can get
       back into the mainstream.

       Several people have asked  me  about  things that other languages
       provide, but so far I haven't addressed in this series.   The two
       biggies are semicolons and  comments.    Perhaps  you've wondered
       about them, too, and  wondered  how things would change if we had
       to  deal with them.  Just so you can proceed with what's to come,
       without being  bothered by that nagging feeling that something is
       missing, we'll address such issues here.


       SEMICOLONS

       Ever since the introduction of Algol, semicolons have been a part
       of  almost every modern language.  We've all  used  them  to  the
       point that they are taken for  granted.   Yet I suspect that more
       compilation errors have  occurred  due  to  misplaced  or missing
       semicolons  than  any  other single cause.  And if we had a penny
       for  every  extra  keystroke programmers have used  to  type  the
       little rascals, we could pay off the national debt.

       Having  been  brought  up with FORTRAN, it took me a long time to
       get used to using semicolons, and to tell the  truth  I've  never
       quite understood why they  were  necessary.    Since I program in
       Pascal, and since the use of semicolons in Pascal is particularly
       tricky,  that one little character is still  by  far  my  biggest
       source of errors.

       When  I  began  developing  KISS,  I resolved to  question  EVERY
       construct in other languages, and to try to avoid the most common
       problems that occur with them.  That puts the semicolon very high
       on my hit list.A62A6
                                     - 2 -A*2A*

PA2A





       To  understand  the  role of the semicolon, you have to look at a
       little history.

       Early programming languages were line-oriented.  In  FORTRAN, for
       example, various parts  of  the statement had specific columns or
       fields that they had to appear in.  Since  some  statements  were
       too  long for one line, the  "continuation  card"  mechanism  was
       provided to let  the  compiler  know  that a given card was still
       part of the previous  line.   The mechanism survives to this day,
       even though punched cards are now things of the distant past.

       When  other  languages  came  along,  they  also  adopted various
       mechanisms for dealing with multiple-line statements.  BASIC is a
       good  example.  It's important to  recognize,  though,  that  the
       FORTRAN  mechanism  was   not   so  much  required  by  the  line
       orientation of that  language,  as by the column-orientation.  In
       those versions of FORTRAN  where  free-form  input  is permitted,
       it's no longer needed.

       When the fathers  of  Algol introduced that language, they wanted
       to get away  from  line-oriented programs like FORTRAN and BASIC,
       and allow for free-form input.   This included the possibility of
       stringing multiple statements on a single line, as in


            a=b; c=d; e=e+1;


       In cases like this,  the  semicolon is almost REQUIRED.  The same
       line, without the semicolons, just looks "funny":


            a=b c= d e=e+1

       I suspect that this is the major ... perhaps ONLY ...  reason for
       semicolons: to keep programs from looking funny.

       But  the  idea  of stringing multiple statements  together  on  a
       single  line  is  a  dubious  one  at  best.  It's not very  good
       programming  style,  and  harks back to  the  days  when  it  was
       considered improtant to conserve cards.  In these  days  of CRT's
       and indented code, the clarity of programs is  far  better served
       by  keeping statements separate.  It's still  nice  to  have  the
       OPTION  of  multiple  statements,  but  it seems a shame to  keep
       programmers  in  slavery  to the semicolon, just to keep that one
       rare case from "looking funny."

       When I started in with KISS, I tried  to  keep  an  open mind.  I
       decided that I would use  semicolons when it became necessary for
       the parser, but not until then.  I figured this would happen just
       about  the time I added the ability  to  spread  statements  over
       multiple lines.  But, as you  can  see, that never happened.  The
       TINY compiler is perfectly  happy  to  parse the most complicated
       statement, spread over any number of lines, without semicolons.A*2A*
                                     - 3 -

PA2A





       Still, there are people  who  have  used  semicolons for so long,
       they feel naked  without them.  I'm one of them.  Once I had KISS
       defined sufficiently well, I began to write a few sample programs
       in the language.    I  discovered,  somewhat to my horror, that I
       kept  putting  semicolons  in anyway.   So  now  I'm  facing  the
       prospect of a NEW  rash  of  compiler  errors, caused by UNWANTED
       semicolons.  Phooey!

       Perhaps more to the point, there are readers out  there  who  are
       designing their own languages, which may  include  semicolons, or
       who  want to use the techniques of  these  tutorials  to  compile
       conventional languages like  C.    In  either case, we need to be
       able to deal with semicolons.


       SYNTACTIC SUGAR

       This whole discussion brings  up  the  issue of "syntactic sugar"
       ... constructs that are added to a language, not because they are
       needed, but because they help make the programs look right to the
       programmer.    After  all, it's nice  to  have  a  small,  simple
       compiler,    but  it  would  be  of  little  use if the resulting
       language  were  cryptic  and hard to program.  The language FORTH
       comes  to mind (a premature OUCH! for the  barrage  I  know  that
       one's going to fetch me).  If we can add features to the language
       that  make the programs easier to read  and  understand,  and  if
       those features  help keep the programmer from making errors, then
       we should do so.    Particularly if the constructs don't add much
       to the complexity of the language or its compiler.

       The  semicolon  could  be considered an example,  but  there  are
       plenty of others, such as the 'THEN' in a IF-statement,  the 'DO'
       in a WHILE-statement,  and  even the 'PROGRAM' statement, which I
       came within a gnat's eyelash of leaving out  of  TINY.    None of
       these tokens  add  much  to  the  syntax  of the language ... the
       compiler can figure out  what's  going on without them.  But some
       folks feel that they  DO  add to the readability of programs, and
       that can be very important.

       There are two schools of thought on this subject, which  are well
       represented by two of our most popular languages, C and Pascal.

       To  the minimalists, all such sugar should be  left  out.    They
       argue that it clutters up the language and adds to the  number of
       keystrokes  programmers  must type.   Perhaps  more  importantly,
       every extra token or keyword represents a trap laying in wait for
       the inattentive programmer.  If you leave out  a  token, misplace
       it, or misspell it, the compiler  will  get you.  So these people
       argue that the best approach is to get rid of such things.  These
       folks tend to like C, which has a minimum of unnecessary keywords
       and punctuation.

       Those from the other school tend to like Pascal.  They argue that
       having to type a few extra characters is a small price to pay forA*2A*
                                     - 4 -

PA2A





       legibility.    After  all, humans have to read the programs, too.
       Their best argument is that each such construct is an opportunity
       to tell the compiler that you really mean for it  to  do what you
       said to.  The sugary tokens serve as useful landmarks to help you
       find your way.

       The differences are well represented by the two  languages.   The
       most oft-heard complaint about  C  is  that  it is too forgiving.
       When you make a mistake in C, the  erroneous  code  is  too often
       another  legal  C  construct.    So  the  compiler  just  happily
       continues to compile, and  leaves  you  to  find the error during
       debug.    I guess that's why debuggers  are  so  popular  with  C
       programmers.

       On the  other  hand,  if  a  Pascal  program compiles, you can be
       pretty  sure that the program will do what you told it.  If there
       is an error at run time, it's probably a design error.

       The  best  example  of  useful  sugar  is  the semicolon  itself.
       Consider the code fragment:


            a=1+(2*b+c)   b...


       Since there is no operator connecting the token 'b' with the rest
       of the  statement, the compiler will conclude that the expression
       ends  with  the  ')', and the 'b'  is  the  beginning  of  a  new
       statement.    But  suppose  I  have simply left out the  intended
       operator, and I really want to say:


            a=1+(2*b+c)*b...


       In  this  case  the compiler will get an error, all right, but it
       won't be very meaningful  since  it will be expecting an '=' sign
       after the 'b' that really shouldn't be there.

       If, on the other hand, I include a semicolon after the  'b', THEN
       there  can  be no doubt where I  intend  the  statement  to  end.
       Syntactic  sugar,  then,  can  serve  a  very  useful purpose  by
       providing some additional insurance that we remain on track.

       I find  myself  somewhere  in  the middle of all this.  I tend to
       favor the Pascal-ers' view ... I'd much rather find  my  bugs  at
       compile time rather than run time.  But I also hate to just throw
       verbosity  in  for  no apparent reason, as in COBOL.  So far I've
       consistently left most of the Pascal sugar out of KISS/TINY.  But
       I certainly have no strong feelings either way, and  I  also  can
       see the value of sprinkling a little sugar around  just  for  the
       extra  insurance  that  it  brings.    If  you like  this  latter
       approach, things like that are easy to add.  Just  remember that,A62A6
                                     - 5 -A*2A*

PA2A

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品亚洲成a人| 3atv在线一区二区三区| 欧美猛男超大videosgay| 精品奇米国产一区二区三区| 国产精品国产自产拍在线| 久久精品国产免费| 欧美三级视频在线播放| 欧美经典一区二区三区| 美国精品在线观看| 欧美三级电影在线观看| 亚洲婷婷在线视频| 国产精品资源在线看| 欧美精品1区2区3区| 亚洲乱码国产乱码精品精小说 | 99久久婷婷国产| 久久精品人人做人人爽人人| 免费视频最近日韩| 欧美日韩在线三级| 一区二区三区在线观看欧美| 成人av手机在线观看| 日韩一区二区在线看| 性做久久久久久免费观看欧美| 99视频在线精品| 国产精品色婷婷| 国产一区二区三区在线观看免费视频| 欧美日韩精品一区二区三区| 亚洲成人免费在线观看| 91色乱码一区二区三区| 一区精品在线播放| 丰满亚洲少妇av| 国产亚洲美州欧州综合国| 九九视频精品免费| 精品国产一区二区三区久久影院 | 一区二区欧美国产| 色哟哟一区二区| 亚洲欧美日韩中文字幕一区二区三区| 风间由美一区二区av101| 欧美成人r级一区二区三区| 奇米888四色在线精品| 337p亚洲精品色噜噜狠狠| 亚洲va国产天堂va久久en| 欧美一区二区在线观看| 久久精品国产亚洲a| 国产亚洲人成网站| 99在线精品观看| 亚洲成人午夜影院| 精品少妇一区二区三区在线视频| 久久黄色级2电影| 久久九九国产精品| 不卡在线观看av| 亚洲精品五月天| 7878成人国产在线观看| 国产乱色国产精品免费视频| 国产精品乱人伦一区二区| 日本乱码高清不卡字幕| 偷窥少妇高潮呻吟av久久免费| 欧美不卡一区二区| 成人性生交大片免费看中文| 亚洲女性喷水在线观看一区| 欧美日本一区二区在线观看| 精品一区二区成人精品| 国产精品久久久久久久久久免费看 | 久久久久国产精品麻豆| 91香蕉视频mp4| 三级久久三级久久| www激情久久| 色综合久久六月婷婷中文字幕| 污片在线观看一区二区 | 日韩欧美亚洲一区二区| 国产高清不卡二三区| 国产精品国产馆在线真实露脸| 欧美色成人综合| 国产精品1024| 日本美女视频一区二区| 国产精品麻豆欧美日韩ww| 欧美日韩国产经典色站一区二区三区 | 欧美一二三四在线| 成人av电影在线| 美女视频一区二区三区| 欧美国产欧美综合| 日韩一区二区三区av| 日本韩国精品在线| 国产一区二区看久久| 亚洲6080在线| 亚洲精品欧美激情| 中文字幕乱码日本亚洲一区二区| 欧美日韩电影在线| 色综合 综合色| 丁香激情综合国产| 久久99久久久欧美国产| 亚洲自拍偷拍av| 亚洲欧美色图小说| 国产精品美女久久久久aⅴ国产馆 国产精品美女久久久久av爽李琼 国产精品美女久久久久高潮 | 在线不卡欧美精品一区二区三区| 国产高清精品久久久久| 麻豆91在线播放| 午夜激情一区二区| 夜夜操天天操亚洲| 国产精品久久久爽爽爽麻豆色哟哟| 日韩欧美精品在线视频| 欧美精品日韩综合在线| 色哟哟国产精品免费观看| 国产精品一级片在线观看| 美国毛片一区二区三区| 日韩va欧美va亚洲va久久| 亚洲一二三四区| 亚洲一区二区三区在线看| 综合久久久久综合| 日韩美女啊v在线免费观看| 久久一留热品黄| 欧美精品一区二区高清在线观看 | www.视频一区| 国产99久久精品| 国产aⅴ综合色| av一区二区三区四区| 国产99精品视频| 不卡的av电影| 色综合亚洲欧洲| 色婷婷香蕉在线一区二区| 一本久道久久综合中文字幕| 91丨九色丨黑人外教| 色视频成人在线观看免| 91久久精品一区二区| 欧美吻胸吃奶大尺度电影 | 青青草伊人久久| 久久99国产精品尤物| 国产精品一区二区三区乱码| 国内精品嫩模私拍在线| 国产91丝袜在线18| 91麻豆6部合集magnet| 色婷婷久久久亚洲一区二区三区| 欧美日韩在线三级| 日韩欧美一区二区在线视频| 亚洲精品一区二区三区影院 | 91精品欧美久久久久久动漫 | 韩国在线一区二区| 国产精品一区二区你懂的| 91免费版pro下载短视频| 欧美亚洲另类激情小说| 日韩欧美中文字幕一区| 国产欧美一区二区精品忘忧草 | 久久国产精品一区二区| 国产成人欧美日韩在线电影| 99视频一区二区| 欧美高清你懂得| 精品sm捆绑视频| 亚洲免费成人av| 免费在线看一区| 9l国产精品久久久久麻豆| 欧美日韩欧美一区二区| 精品国产凹凸成av人网站| 国产精品久久免费看| 午夜精品一区二区三区电影天堂| 久久草av在线| 在线视频亚洲一区| 精品美女一区二区| 综合久久给合久久狠狠狠97色 | 91麻豆精品久久久久蜜臀| 国产喂奶挤奶一区二区三区| 亚洲在线观看免费| 国产乱子轮精品视频| 欧美性生活大片视频| 国产亚洲精品aa| 日韩成人dvd| 在线精品视频一区二区| 久久综合久久综合亚洲| 亚欧色一区w666天堂| 本田岬高潮一区二区三区| 日韩免费性生活视频播放| 尤物av一区二区| 国产成人8x视频一区二区 | 欧美性色aⅴ视频一区日韩精品| 欧美精品一区二| 日韩高清国产一区在线| 在线亚洲+欧美+日本专区| 国产午夜一区二区三区| 日本美女一区二区三区| 欧美三片在线视频观看| 成人免费一区二区三区视频| 国产在线视视频有精品| 欧美日韩精品综合在线| 日韩码欧中文字| 国产91精品一区二区麻豆亚洲| 欧美一区二区不卡视频| 亚洲午夜久久久久久久久久久 | 日韩欧美在线不卡| 亚洲成av人片在线观看无码| 99麻豆久久久国产精品免费| 精品国产精品网麻豆系列| 日韩中文欧美在线| 欧美精品 日韩| 性欧美疯狂xxxxbbbb| 91国产丝袜在线播放| 亚洲欧美另类久久久精品| 成人在线综合网站| 国产三级精品视频| 国产福利一区二区三区视频在线| 精品国产免费人成电影在线观看四季| 日韩av中文字幕一区二区三区| 欧美日韩国产成人在线91|