美文网首页
project Abeona #2

project Abeona #2

作者: 放假广告 | 来源:发表于2018-10-14 09:16 被阅读0次

    Scanner:

    1. character-by-character formulation:
      recognizing "new" pseudocode:
    c <- NextChar();
    if ( c = 'n')
        then begin:
            c <- NextChar();
            if ( c = 'e' )
                then begin:
                    c <- NextChar();
                    if ( c = 'w' )
                        then report success;
                        else try something else;
                    end;
                    else try something else;
                end;
                else try something else;
    

    -> S0 -'n'-> S1 -'e'-> S2 -'w'-> S3 (to recognize "new")
    -> S0 -'n'-> S1 -'e'-> S2 -'w'-> S3
                         \-'o'-> S4 -'t'-> S5 (to recognize "new" and "not")

    1. Finite Automata:
      Formal mathematical objects for above recognizer.
      (S, \Sigma, \delta, s0, SA)
      S is the finite set of states in the recognizer, along with an error state se.
      \Sigma is the finite alphabet used by the recognizer, the union of the edge labels in the transition diagram.
      \delta(s, c) is the recognizer's transition function. It maps each state s\in S and each character c \in \Sigma into some next state.
      s_0\in S is the designate start state.
      S_A is the set of accepting states, S_A\subseteq S.

    the FA for new or not or while \xrightarrow{a}

    相关文章

      网友评论

          本文标题:project Abeona #2

          本文链接:https://www.haomeiwen.com/subject/clhzaftx.html