handouts/ho04.tex
changeset 643 08375ca3874e
parent 596 6d6e79f95933
child 669 2f5a4d76756d
equal deleted inserted replaced
642:064afa8fc1d9 643:08375ca3874e
   799 By using the records and extracting the environment, the 
   799 By using the records and extracting the environment, the 
   800 result is the following list:
   800 result is the following list:
   801 
   801 
   802 \begin{center}\tt
   802 \begin{center}\tt
   803 \begin{tabular}{l}
   803 \begin{tabular}{l}
   804 KEYWORD(if),\\ 
   804 (k, if),\\ 
   805 WHITESPACE,\\ 
   805 (w, " "),\\ 
   806 IDENT(true),\\ 
   806 (i, true),\\ 
   807 WHITESPACE,\\ 
   807 (w, " "),\\ 
   808 KEYWORD(then),\\ 
   808 (k, then),\\ 
   809 WHITESPACE,\\ 
   809 (w, " "),\\ 
   810 KEYWORD(then),\\ 
   810 (k, then),\\ 
   811 WHITESPACE,\\ 
   811 (w, " "),\\ 
   812 NUM(42),\\ 
   812 (n, 42),\\ 
   813 WHITESPACE,\\ 
   813 (w, " "),\\ 
   814 KEYWORD(else),\\ 
   814 (k, else),\\ 
   815 WHITESPACE,\\ 
   815 (w, " "),\\ 
   816 OP(+)
   816 (o, +)
   817 \end{tabular}
   817 \end{tabular}
   818 \end{center}
   818 \end{center}
   819 
   819 
   820 \noindent Typically we are not interested in the whitespaces 
   820 \noindent Typically we are not interested in the whitespaces 
   821 and comments and would filter them out: this gives
   821 and comments and would filter them out: this gives
   822 
   822 
   823 \begin{center}\tt
   823 \begin{center}\tt
   824 \begin{tabular}{l}
   824 \begin{tabular}{l}
   825 KEYWORD(if),\\ 
   825   (k, if),\\ 
   826 IDENT(true),\\ 
   826   (i, true),\\ 
   827 KEYWORD(then),\\ 
   827   (k, then),\\ 
   828 KEYWORD(then),\\ 
   828   (k, then),\\ 
   829 NUM(42),\\ 
   829   (n, 42),\\ 
   830 KEYWORD(else),\\ 
   830   (k, else),\\ 
   831 OP(+)
   831   (o, +)
   832 \end{tabular}
   832 \end{tabular}
   833 \end{center}
   833 \end{center}
   834 
   834 
   835 \noindent
   835 \noindent
   836 which will be the input for the next phase of our compiler.
   836 which will be the input for the next phase of our compiler.