slides/slides07.tex
changeset 807 9fa90c73c6f3
parent 744 99c5916d9a8f
child 808 ba3edaf7dc49
equal deleted inserted replaced
806:0d3bc1d0d987 807:9fa90c73c6f3
    48 
    48 
    49 \end{frame}
    49 \end{frame}
    50 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
    50 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
    51 
    51 
    52 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    52 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    53 \begin{frame}[c]
    53 \begin{frame}[t]
    54 \frametitle{Bird's Eye View}
    54 \frametitle{Bird's Eye View}
    55 
    55 \mbox{}\\[-16mm]\mbox{}
    56 \begin{center}
    56 
    57 \begin{tikzpicture}
    57 \begin{center}
    58 \node (rexp)  {\bl{\bf Lexer}};
    58   \begin{tikzpicture}[scale=1,
    59 \node (nfa) [right=of rexp] {\bl{\bf Parser}};
    59                       node/.style={
    60 \node (dfa) [right=of nfa] 
    60                       rectangle,rounded corners=3mm,
    61  {\bl{\begin{tabular}{c}\bf Machine Code/\\\bf Java Byte Code\end{tabular}}};
    61                       very thick,draw=black!50,
    62 \path[->, red, line width=2mm] (rexp) edge node [above=4mm, black] {\begin{tabular}{c@{\hspace{9mm}}}token\\[-1mm]
    62                       minimum height=18mm, minimum width=20mm,
    63 sequence\end{tabular}} (nfa);
    63                       top color=white,bottom color=black!20,drop shadow}]
    64 \path[->, red, line width=2mm] (nfa) edge node [above=4mm, black] {\begin{tabular}{c}parse\\[-1mm] tree\end{tabular}}(dfa);
    64   \node (0) at (-2.3,0) {}; 
    65 \end{tikzpicture}\\
    65   
    66 \end{center}
    66   \node (A) at (0,0)  [node] {};
    67 
    67   \node [below right] at (A.north west) {lexer};
    68 \end{frame}
    68 
    69 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
    69   \node (B) at (3,0)  [node] {};
    70  
    70   \node [below right=1mm] at (B.north west) 
    71 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    71     {\mbox{}\hspace{-1mm}parser};
    72 \begin{frame}[c]
    72 
    73 \frametitle{CW3}
    73   \node (C) at (6,0)  [node] {};
    74 
    74   \node [below right] at (C.north west) 
    75 Atomic parsers for tokens
    75     {\mbox{}\hspace{-1mm}code gen};
    76 
    76 
    77 \begin{center}
    77   \node (1) at (8.4,0) {}; 
    78 \bl{$\texttt{T\_Num(123)}::rest \;\Rightarrow\; \{(\texttt{T\_Num(123)}, rest)\}$} 
    78 
    79 \end{center}\bigskip
    79   \draw [->,line width=4mm] (0) -- (A); 
    80 
    80   \draw [->,line width=4mm] (A) -- (B); 
    81 \begin{itemize}
    81   \draw [->,line width=4mm] (B) -- (C); 
    82 \item you consume one or more token from the\\ 
    82   \draw [->,line width=4mm] (C) -- (1); 
    83   input (stream)
    83   \end{tikzpicture}
    84 \item \bl{\texttt{T\_NUM(1), T\_OP(+), T\_NUM(2)}}\bigskip
    84   \end{center}
    85 \item a good starting point would be \texttt{comb2.scala} 
    85   
    86 \item in case CW2 did not work, use \texttt{toks.scala} as 
    86 \end{frame}
    87   input to the parser
    87 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    88 \end{itemize}
    88 
    89 \end{frame}
       
    90 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
    91 
    89 
    92 
    90 
    93 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    91 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    94 \begin{frame}[c]
    92 \begin{frame}[c]
    95 \begin{textblock}{10}(0.5,0.5)
    93 \begin{textblock}{10}(0.5,0.5)
   105 \end{textblock}
   103 \end{textblock}
   106 
   104 
   107 
   105 
   108 \fontsize{8}{10}\selectfont
   106 \fontsize{8}{10}\selectfont
   109 %\footnotesize
   107 %\footnotesize
   110 \mbox{}\\[-8mm]\mbox{}
   108 \mbox{}\\[-13mm]\mbox{}
   111 
   109 
   112 \begin{columns}
   110 \begin{columns}
   113 \begin{column}{2cm} 
   111 \begin{column}{2cm} 
   114 \lstinputlisting[numbers=none]{../progs/appHa.j}
   112 \lstinputlisting[numbers=none]{../progs/appHa.j}
   115 \end{column}
   113 \end{column}