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

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

?? yacc-docs.txt

?? 句法分析器。一般用文法(grammar)來刻畫.常見的是短語結(jié)構(gòu)文法(chomsky hierarchy),其中最常用的是上下文無關(guān)文法(CFG)。
?? TXT
?? 第 1 頁(yè) / 共 5 頁(yè)
字號(hào):

can be structured according to these rules in two ways:

        IF  (  C1  )  {
                IF  (  C2  )  S1
                }
        ELSE  S2

or

        IF  (  C1  )  {
                IF  (  C2  )  S1
                ELSE  S2
                }

The second interpretation is the one given  in  most  programming
languages  having  this  construct.  Each ELSE is associated with
the last preceding ``un-ELSE'd'' IF.  In this  example,  consider
the situation where the parser has seen

        IF  (  C1  )  IF  (  C2  )  S1

and is looking at the ELSE.  It can  immediately  reduce  by  the
simple-if rule to get

        IF  (  C1  )  stat

and then read the remaining input,

        ELSE  S2

and reduce

        IF  (  C1  )  stat  ELSE  S2

by the if-else rule.  This leads to the first of the above group-
ings of the input.

     On the other hand, the ELSE may be  shifted,  S2  read,  and
then the right hand portion of

        IF  (  C1  )  IF  (  C2  )  S1  ELSE  S2

can be reduced by the if-else rule to get










Yacc: Yet Another Compiler-Compiler                     PS1:15-19



        IF  (  C1  )  stat

which can be reduced by the simple-if rule.  This  leads  to  the
second  of  the  above  groupings  of the input, which is usually
desired.

     Once again the parser can do two valid things - there  is  a
shift/reduce  conflict.  The application of disambiguating rule 1
tells the parser to shift  in  this  case,  which  leads  to  the
desired grouping.

     This shift/reduce conflict arises only when there is a  par-
ticular current input symbol, ELSE, and particular inputs already
seen, such as

        IF  (  C1  )  IF  (  C2  )  S1

In general, there may be many conflicts, and  each  one  will  be
associated  with  an  input  symbol  and a set of previously read
inputs.  The previously read  inputs  are  characterized  by  the
state of the parser.

     The conflict messages of Yacc are best understood by examin-
ing the verbose (-v) option output file.  For example, the output
corresponding to the above conflict state might be:

23: shift/reduce conflict (shift 45, reduce 18) on ELSE

state 23

          stat  :  IF  (  cond  )  stat_         (18)
          stat  :  IF  (  cond  )  stat_ELSE  stat

         ELSE     shift 45
         .        reduce 18


The first line describes the conflict, giving the state  and  the
input symbol.  The ordinary state description follows, giving the
grammar rules active  in  the  state,  and  the  parser  actions.
Recall  that the underline marks the portion of the grammar rules
which has been seen.  Thus in the example, in state 23 the parser
has seen input corresponding to

        IF  (  cond  )  stat

and the two grammar rules shown are active  at  this  time.   The
parser  can do two possible things.  If the input symbol is ELSE,
it is possible to shift into state 45.  State 45  will  have,  as
part of its description, the line

        stat  :  IF  (  cond  )  stat  ELSE_stat










PS1:15-20                     Yacc: Yet Another Compiler-Compiler


since the ELSE will have been shifted in  this  state.   Back  in
state  23,  the  alternative action, described by ``.'', is to be
done if the input symbol is not mentioned explicitly in the above
actions; thus, in this case, if the input symbol is not ELSE, the
parser reduces by grammar rule 18:

        stat  :  IF  '('  cond  ')'  stat

Once again, notice that the numbers following ``shift''  commands
refer  to  other  states,  while the numbers following ``reduce''
commands refer to grammar rule numbers.  In  the  y.output  file,
the  rule  numbers  are  printed  after  those rules which can be
reduced.  In most one states, there will be at most reduce action
possible in the state, and this will be the default command.  The
user who encounters unexpected shift/reduce conflicts will  prob-
ably  want  to  look  at the verbose output to decide whether the
default actions are appropriate.  In really tough cases, the user
might  need  to  know more about the behavior and construction of
the parser than can be covered here.  In this case,  one  of  the
theoretical  references[2, 3, 4] might be consulted; the services
of a local guru might also be appropriate.

6: Precedence

     There is one common situation where the  rules  given  above
for  resolving conflicts are not sufficient; this is in the pars-
ing of arithmetic expressions.  Most of the  commonly  used  con-
structions  for arithmetic expressions can be naturally described
by the notion of precedence levels for operators,  together  with
information about left or right associativity.  It turns out that
ambiguous grammars with appropriate disambiguating rules  can  be
used  to  create parsers that are faster and easier to write than
parsers constructed from unambiguous grammars.  The basic  notion
is to write grammar rules of the form

        expr  :  expr  OP  expr

and

        expr  :  UNARY  expr

for all binary and unary operators desired.  This creates a  very
ambiguous  grammar, with many parsing conflicts.  As disambiguat-
ing  rules,  the  user  specifies  the  precedence,  or   binding
strength,  of  all  the  operators,  and the associativity of the
binary operators.  This information is sufficient to  allow  Yacc
to  resolve the parsing conflicts in accordance with these rules,
and construct a parser that realizes the desired precedences  and
associativities.

     The precedences and associativities are attached  to  tokens
in  the  declarations section.  This is done by a series of lines
beginning with a Yacc keyword: %left, %right, or %nonassoc,  fol-
lowed  by  a  list of tokens.  All of the tokens on the same line









Yacc: Yet Another Compiler-Compiler                     PS1:15-21


are assumed to have the same precedence level and  associativity;
the lines are listed in order of increasing precedence or binding
strength.  Thus,

        %left  '+'  '-'
        %left  '*'  '/'

describes the precedence and associativity of the four arithmetic
operators.   Plus  and minus are left associative, and have lower
precedence than star and slash, which are also left  associative.
The  keyword  %right is used to describe right associative opera-
tors, and the keyword %nonassoc is used  to  describe  operators,
like  the  operator  .LT. in Fortran, that may not associate with
themselves; thus,

        A  .LT.  B  .LT.  C

is illegal in Fortran, and such an operator  would  be  described
with  the  keyword  %nonassoc  in  Yacc.   As  an  example of the
behavior of these declarations, the description

        %right  '='
        %left  '+'  '-'
        %left  '*'  '/'

        %%

        expr    :       expr  '='  expr
                |       expr  '+'  expr
                |       expr  '-'  expr
                |       expr  '*'  expr
                |       expr  '/'  expr
                |       NAME
                ;

might be used to structure the input

        a  =  b  =  c*d  -  e  -  f*g

as follows:

        a = ( b = ( ((c*d)-e) - (f*g) ) )

When this mechanism is used, unary operators must, in general, be
given  a  precedence.   Sometimes  a  unary operator and a binary
operator have the same  symbolic  representation,  but  different
precedences.  An example is unary and binary '-'; unary minus may
be given the same strength as  multiplication,  or  even  higher,
while binary minus has a lower strength than multiplication.  The
keyword, %prec, changes the precedence level  associated  with  a
particular  grammar  rule.   %prec  appears immediately after the
body of the grammar rule, before the action or closing semicolon,
and  is  followed by a token name or literal.  It causes the pre-
cedence of the grammar rule to become that of the following token









PS1:15-22                     Yacc: Yet Another Compiler-Compiler


name  or literal.  For example, to make unary minus have the same
precedence as multiplication the rules might resemble:

        %left  '+'  '-'
        %left  '*'  '/'

        %%

        expr    :       expr  '+'  expr
                |       expr  '-'  expr
                |       expr  '*'  expr
                |       expr  '/'  expr
                |       '-'  expr      %prec  '*'
                |       NAME
                ;


     A token declared by %left, %right, and  %nonassoc  need  not
be, but may be, declared by %token as well.

     The precedences and associativities  are  used  by  Yacc  to
resolve  parsing  conflicts;  they  give  rise  to disambiguating
rules.  Formally, the rules work as follows:

1.   The precedences and associativities are recorded  for  those
     tokens and literals that have them.

2.   A precedence and associativity is associated with each gram-
     mar rule; it is the precedence and associativity of the last
     token or literal in the body of the rule.  If the %prec con-
     struction  is used, it overrides this default.  Some grammar
     rules may have no precedence  and  associativity  associated
     with them.

3.   When there is  a  reduce/reduce  conflict,  or  there  is  a
     shift/reduce  conflict  and  either  the input symbol or the
     grammar rule has no precedence and associativity,  then  the
     two  disambiguating rules given at the beginning of the sec-
     tion are used, and the conflicts are reported.

4.   If there is a shift/reduce conflict, and  both  the  grammar
     rule  and  the  input character have precedence and associa-
     tivity associated with them, then the conflict  is  resolved
     in favor of the action (shift or reduce) associated with the
     higher precedence.  If the precedences are  the  same,  then
     the  associativity is used; left associative implies reduce,
     right associative implies shift, and nonassociating  implies
     error.

     Conflicts resolved by precedence  are  not  counted  in  the
number  of  shift/reduce  and reduce/reduce conflicts reported by
Yacc.  This means that mistakes  in  the  specification  of  pre-
cedences  may  disguise errors in the input grammar; it is a good
idea  to  be  sparing  with  precedences,  and  use  them  in  an









Yacc: Yet Another Compiler-Compiler                     PS1:15-23


essentially  ``cookbook'' fashion, until some experience has been
gained.  The y.output file is very useful in deciding whether the
parser is actually doing what was intended.

7: Error Handling

     Error handling is an extremely difficult area, and  many  of
the  problems  are  semantic  ones.   When an error is found, for
example, it may be  necessary  to  reclaim  parse  tree  storage,
delete  or  alter  symbol  table  entries,  and,  typically,  set
switches to avoid generating any further output.

     It is seldom acceptable to stop all processing when an error
is  found;  it  is  more useful to continue scanning the input to
find further syntax errors.  This leads to the problem of getting
the  parser  ``restarted''  after  an  error.  A general class of
algorithms to do this involves discarding a number of tokens from
the  input  string,  and  attempting to adjust the parser so that
input can continue.

     To allow the user some control over this process, Yacc  pro-
vides  a simple, but reasonably general, feature.  The token name
``error'' is reserved for error handling.  This name can be  used
in  grammar rules; in effect, it suggests places where errors are
expected, and recovery might take place.   The  parser  pops  its
stack until it enters a state where the token ``error'' is legal.
It then behaves as if the token ``error'' were the current looka-
head  token,  and performs the action encountered.  The lookahead
token is then reset to the token that caused the  error.   If  no
special  error  rules  have  been specified, the processing halts
when an error is detected.

     In order to prevent a cascade of error messages, the parser,
after  detecting  an  error,  remains  in error state until three
tokens have been successfully read and shifted.  If an  error  is
detected when the parser is already in error state, no message is
given, and the input token is quietly deleted.

     As an example, a rule of the form

        stat    :       error

would, in effect, mean that on a syntax error  the  parser  would
attempt  to  skip over the statement in which the error was seen.
More precisely, the parser will scan  ahead,  looking  for  three
tokens  that might legally follow a statement, and start process-
ing at the first of these; if the beginnings  of  statements  are
not  sufficiently  distinctive,  it may make a false start in the
middle of a statement, and end up reporting a second error  where
there is in fact no error.

     Actions may be used with these special error  rules.   These
actions  might  attempt  to  reinitialize  tables, reclaim symbol
table space, etc.




?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲一区电影777| 三级精品在线观看| 欧美高清在线精品一区| 精品欧美乱码久久久久久1区2区| 欧美日本在线播放| 欧美写真视频网站| 欧美私人免费视频| 欧美日韩高清一区二区不卡| 717成人午夜免费福利电影| 欧美精品在欧美一区二区少妇| 欧美三级午夜理伦三级中视频| 色av综合在线| 欧美日韩一卡二卡| 欧美一区二区精品在线| 亚洲精品在线免费观看视频| 精品国产不卡一区二区三区| 久久久久久免费| 国产欧美日韩久久| 中文字幕五月欧美| 亚洲国产日韩一区二区| 日韩中文字幕av电影| 老汉av免费一区二区三区| 精品一区二区免费看| 国产精品456露脸| 91女厕偷拍女厕偷拍高清| 日本丶国产丶欧美色综合| 欧美片在线播放| 欧美成人video| 中文字幕欧美国产| 一区二区三区在线视频免费| 偷窥少妇高潮呻吟av久久免费| 日韩电影在线一区二区| 国产在线播放一区| 99久久久国产精品免费蜜臀| 欧美中文字幕不卡| 精品成人免费观看| 亚洲乱码国产乱码精品精小说 | 亚洲精品五月天| 亚洲成人综合在线| 久久精品国产免费看久久精品| 国产传媒一区在线| 色婷婷久久99综合精品jk白丝| 欧美精品国产精品| 国产欧美视频在线观看| 一区二区三区波多野结衣在线观看 | 久久亚洲精品国产精品紫薇| 国产精品伦一区| 日韩精品乱码av一区二区| 国产一区二区毛片| 欧美伊人久久大香线蕉综合69| 欧美电视剧免费全集观看| 国产精品久久久久永久免费观看| 亚洲国产一区视频| 国产精品影视网| 欧美日韩中文一区| 久久久久国产精品麻豆ai换脸| 一区二区三区.www| 国产精品自在欧美一区| 在线观看一区二区视频| 久久久久亚洲综合| 视频一区二区三区中文字幕| 成人动漫一区二区在线| 欧美一区二区福利视频| 亚洲视频香蕉人妖| 国产精品综合一区二区三区| 欧洲国产伦久久久久久久| 国产午夜精品理论片a级大结局| 亚洲在线视频一区| 成人久久18免费网站麻豆| 日韩一区和二区| 亚洲激情一二三区| 成人高清免费观看| 精品国产乱码久久久久久浪潮| 亚洲香蕉伊在人在线观| 99久久精品99国产精品| 26uuu亚洲综合色欧美| 亚洲h在线观看| 色天天综合色天天久久| 欧美国产日韩一二三区| 久久精品国产色蜜蜜麻豆| 在线播放中文字幕一区| 亚洲国产精品久久久久婷婷884| 成人app网站| 亚洲国产精品精华液2区45| 麻豆高清免费国产一区| 欧美日本一区二区三区四区| 一区二区三区中文字幕| 一本一本久久a久久精品综合麻豆| 久久久久久久久久久99999| 麻豆传媒一区二区三区| 欧美一级高清片| 丝袜美腿一区二区三区| 欧美视频在线播放| 亚洲国产成人精品视频| 在线看日韩精品电影| 亚洲视频综合在线| 暴力调教一区二区三区| 国产精品天干天干在线综合| 国产成人午夜高潮毛片| 日本一区免费视频| 国产91色综合久久免费分享| 国产三级一区二区| 成人综合婷婷国产精品久久| 国产亚洲污的网站| 成人在线一区二区三区| 国产欧美一区二区三区在线看蜜臀 | 国产欧美日韩亚州综合| 丁香六月综合激情| 国产精品美女久久久久久久网站| 懂色av一区二区三区免费观看| 欧美国产视频在线| av资源网一区| 亚洲欧洲成人精品av97| 丁香桃色午夜亚洲一区二区三区| 国产视频一区在线播放| 成人av网站大全| 一区二区三区中文在线| 欧美日韩高清一区二区不卡| 免费亚洲电影在线| 久久久精品影视| 波多野结衣在线一区| 亚洲图片你懂的| 欧美日韩你懂得| 久久aⅴ国产欧美74aaa| 久久精品夜色噜噜亚洲aⅴ| 成人午夜看片网址| 亚洲男人电影天堂| 69久久夜色精品国产69蝌蚪网| 麻豆精品一区二区av白丝在线| xnxx国产精品| 91美女福利视频| 亚洲成人动漫av| 精品免费一区二区三区| voyeur盗摄精品| 亚洲超丰满肉感bbw| 亚洲精品在线观看视频| aaa欧美日韩| 三级久久三级久久| 欧美激情一区在线| 欧美日韩精品一区视频| 国产在线精品免费| 亚洲美女在线一区| 91精品国产麻豆国产自产在线| 国产一区二区成人久久免费影院| 中文av一区特黄| 7777精品久久久大香线蕉| 国产高清一区日本| 亚洲高清不卡在线观看| 久久久亚洲高清| 欧美性做爰猛烈叫床潮| 国产麻豆一精品一av一免费| 亚洲欧美另类在线| 欧美大片一区二区| 91麻豆蜜桃一区二区三区| 日本欧美加勒比视频| 国产精品高清亚洲| 日韩一级片在线播放| 97精品电影院| 极品少妇一区二区| 亚洲一区二区在线视频| 久久久久久免费| 欧美久久久一区| 菠萝蜜视频在线观看一区| 男女男精品网站| 亚洲精品少妇30p| 久久久久亚洲蜜桃| 69精品人人人人| 在线视频你懂得一区| 成人午夜在线播放| 美日韩一区二区| 亚洲综合无码一区二区| 国产精品水嫩水嫩| 日韩欧美不卡在线观看视频| 日本伦理一区二区| 成人综合婷婷国产精品久久 | 欧美视频精品在线| 高清不卡一区二区在线| 麻豆91在线看| 亚洲成人自拍一区| 一区二区三区四区在线| 国产色91在线| 久久奇米777| 欧美一区二区网站| 日本高清成人免费播放| 99在线精品观看| 丁香激情综合国产| 国产精品一二三区| 国产精品一区一区| 蜜臀av亚洲一区中文字幕| 午夜欧美在线一二页| 亚洲精品老司机| 中文字幕一区二区三区av| 久久亚洲捆绑美女| 2021中文字幕一区亚洲| 日韩亚洲欧美在线观看| 欧美日韩二区三区| 欧美日韩久久久| 91成人免费在线视频| 色视频欧美一区二区三区| 99精品国产一区二区三区不卡 |