slides/slides05.tex
changeset 588 a4646557016d
parent 583 200d2a3eb1b1
child 593 bb24d4e207b6
equal deleted inserted replaced
587:5ddedcd92d84 588:a4646557016d
   596 \frametitle{Palindromes}
   596 \frametitle{Palindromes}
   597 
   597 
   598 A grammar for palindromes over the alphabet~\bl{$\{a,b\}$}:
   598 A grammar for palindromes over the alphabet~\bl{$\{a,b\}$}:
   599 
   599 
   600 \bl{\begin{plstx}[margin=3cm]
   600 \bl{\begin{plstx}[margin=3cm]
   601 : \meta{S} ::= \epsilon\\
       
   602 : \meta{S} ::= a\cdot\meta{S}\cdot a\\
   601 : \meta{S} ::= a\cdot\meta{S}\cdot a\\
   603 : \meta{S} ::= b\cdot\meta{S}\cdot b\\
   602 : \meta{S} ::= b\cdot\meta{S}\cdot b\\
       
   603 : \meta{S} ::= a\\
       
   604 : \meta{S} ::= b\\
       
   605 : \meta{S} ::= \epsilon\\
   604 \end{plstx}}\pause
   606 \end{plstx}}\pause
   605 
   607 
   606 or
   608 or
   607 
   609 
   608 \bl{\begin{plstx}[margin=2cm]
   610 \bl{\begin{plstx}[margin=2cm]
   609 : \meta{S} ::=  \epsilon | a\cdot \meta{S}\cdot a | b\cdot \meta{S}\cdot b \\
   611 : \meta{S} ::=  a\cdot \meta{S}\cdot a | b\cdot \meta{S}\cdot b | a | b | \epsilon\\
   610 \end{plstx}}\pause\bigskip
   612 \end{plstx}}\pause\bigskip
   611 
   613 
   612 \small
   614 \small
   613 Can you find the grammar rules for matched parentheses?
   615 Can you find the grammar rules for matched parentheses?
   614 
   616