210 \end{textblock}} |
210 \end{textblock}} |
211 |
211 |
212 \only<10>{ |
212 \only<10>{ |
213 \begin{textblock}{6}(1,3) |
213 \begin{textblock}{6}(1,3) |
214 \begin{bubble}[11cm] |
214 \begin{bubble}[11cm] |
215 Compiler explorers, e.g.: \url{https://gcc.godbolt.org} |
215 Compiler explorers, e.g.: \url{https://gcc.godbolt.org} \;\video{https://youtu.be/ysaBmhMEyUg} |
216 \begin{tikzpicture}[] |
216 \begin{tikzpicture}[] |
217 \node (0) at (-2.3,0) {\includegraphics[scale=0.3]{pics/csource.png}}; |
217 \node (0) at (-2.3,0) {\includegraphics[scale=0.3]{pics/csource.png}}; |
218 \node (1) [right=35mm] at (0) {\includegraphics[scale=0.3]{pics/cassmbl.png}}; |
218 \node (1) [right=35mm] at (0) {\includegraphics[scale=0.3]{pics/cassmbl.png}}; |
219 \draw [->,line width=4mm, red] (0) -- (1); |
219 \draw [->,line width=4mm, red] (0) -- (1); |
220 \node (2) [below=20mm] at (0) {\LARGE\bf``source''}; |
220 \node (2) [below=20mm] at (0) {\LARGE\bf source}; |
221 \node (3) [right=40mm] at (2) {\LARGE\bf``binary''}; |
221 \node (3) [right=40mm] at (2) {\LARGE\bf binary}; |
|
222 \draw [->,line width=1mm] (2) -- (3); |
|
223 \end{tikzpicture} |
|
224 \end{bubble} |
|
225 |
|
226 \end{textblock}} |
|
227 \only<11>{ |
|
228 \begin{textblock}{6}(1,3) |
|
229 \begin{bubble}[11cm] |
|
230 Compiler explorer for Java: \url{https://javap.yawk.at} |
|
231 \begin{tikzpicture}[] |
|
232 \node (0) at (-2.3,0) {\includegraphics[scale=0.4]{pics/jsource.png}}; |
|
233 \node (1) [right=35mm] at (0) {\includegraphics[scale=0.4]{pics/jassmbl.png}}; |
|
234 \draw [->,line width=4mm, red] (0) -- (1); |
|
235 \node (2) [below=20mm] at (0) {\LARGE\bf source}; |
|
236 \node (3) [right=40mm] at (2) {\LARGE\bf byte code}; |
222 \draw [->,line width=1mm] (2) -- (3); |
237 \draw [->,line width=1mm] (2) -- (3); |
223 \end{tikzpicture} |
238 \end{tikzpicture} |
224 \end{bubble} |
239 \end{bubble} |
225 \end{textblock}} |
240 \end{textblock}} |
226 |
241 |
300 \begin{textblock}{6}(8,4.5) |
315 \begin{textblock}{6}(8,4.5) |
301 \includegraphics[scale=0.28]{../pics/777.png} |
316 \includegraphics[scale=0.28]{../pics/777.png} |
302 \end{textblock}} |
317 \end{textblock}} |
303 |
318 |
304 \end{frame} |
319 \end{frame} |
305 %%%%%%%%%%% |
320 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
321 |
|
322 |
|
323 |
|
324 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
325 \begin{frame}[c] |
|
326 \frametitle{What Do Compilers Do?} |
|
327 |
|
328 Remember BF*** from PEP? |
|
329 |
|
330 \begin{center} |
|
331 \begin{tabular}{rcl} |
|
332 \bl{\texttt{>}} & $\Rightarrow$ & move one cell right\\ |
|
333 \bl{\texttt{<}} & $\Rightarrow$ & move one cell left\\ |
|
334 \bl{\texttt{+}} & $\Rightarrow$ & increase cell by one\\ |
|
335 \bl{\texttt{-}} & $\Rightarrow$ & decrease cell by one\\ |
|
336 \bl{\texttt{.}} & $\Rightarrow$ & print current cell\\ |
|
337 \bl{\texttt{,}} & $\Rightarrow$ & input current cell\\ |
|
338 \bl{\texttt{[}} & $\Rightarrow$ & loop begin\\ |
|
339 \bl{\texttt{]}} & $\Rightarrow$ & loop end\medskip\\ |
|
340 & $\Rightarrow$ & everything else is a comment\\ |
|
341 \end{tabular} |
|
342 \end{center} |
|
343 |
|
344 \end{frame} |
|
345 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
346 |
|
347 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
348 \begin{frame}[c] |
|
349 \frametitle{A ``Compiler'' for BF*** to C} |
|
350 |
|
351 \begin{center} |
|
352 \begin{tabular}{rcl} |
|
353 \bl{\texttt{>}} & $\Rightarrow$ & \texttt{ptr++}\\ |
|
354 \bl{\texttt{<}} & $\Rightarrow$ & \texttt{ptr--}\\ |
|
355 \bl{\texttt{+}} & $\Rightarrow$ & \texttt{(*ptr)++}\\ |
|
356 \bl{\texttt{-}} & $\Rightarrow$ & \texttt{(*ptr)--}\\ |
|
357 \bl{\texttt{.}} & $\Rightarrow$ & \texttt{putchar(*ptr)}\\ |
|
358 \bl{\texttt{,}} & $\Rightarrow$ & \texttt{*ptr = getchar()}\\ |
|
359 \bl{\texttt{[}} & $\Rightarrow$ & \texttt{while(*ptr)\{}\\ |
|
360 \bl{\texttt{]}} & $\Rightarrow$ & \texttt{\}}\medskip\\ |
|
361 & $\Rightarrow$ & ignore everything else\\ |
|
362 \end{tabular} |
|
363 \end{center}\bigskip |
|
364 |
|
365 \texttt{char field[30000]\\ char *ptr = \&field[15000]} |
|
366 |
|
367 \end{frame} |
|
368 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
369 |
|
370 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
371 \begin{frame}[c] |
|
372 \frametitle{A ``Compiler'' for BF*** to C} |
|
373 |
|
374 \begin{center} |
|
375 \begin{tabular}{rcl} |
|
376 \bl{\texttt{>\ldots>}} & $\Rightarrow$ & \texttt{ptr += n}\\ |
|
377 \bl{\texttt{<\ldots<}} & $\Rightarrow$ & \texttt{ptr -= n}\\ |
|
378 \bl{\texttt{+\ldots+}} & $\Rightarrow$ & \texttt{(*ptr) += n}\\ |
|
379 \bl{\texttt{-\ldots-}} & $\Rightarrow$ & \texttt{(*ptr) -= n}\\ |
|
380 \bl{\texttt{.}} & $\Rightarrow$ & \texttt{putchar(*ptr)}\\ |
|
381 \bl{\texttt{,}} & $\Rightarrow$ & \texttt{*ptr = getchar()}\\ |
|
382 \bl{\texttt{[}} & $\Rightarrow$ & \texttt{while(*ptr)\{}\\ |
|
383 \bl{\texttt{]}} & $\Rightarrow$ & \texttt{\}}\medskip\\ |
|
384 & $\Rightarrow$ & ignore everything else\\ |
|
385 \end{tabular} |
|
386 \end{center}\bigskip |
|
387 |
|
388 \texttt{char field[30000]\\ char *ptr = \&field[15000]} |
|
389 |
|
390 \end{frame} |
|
391 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
392 |
|
393 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
394 \begin{frame}[c] |
|
395 \frametitle{Recap} |
|
396 |
|
397 \begin{itemize} |
|
398 \item interpreter \bl{\texttt{bfi.sc}} \\$\Rightarrow$ 11 mins\pause |
|
399 \item simple compiler \bl{\texttt{bfi0.sc}}, no optimisations \\$\Rightarrow$ 20 secs\pause |
|
400 \item ``advanced'' compiler \bl{\texttt{bfi1.sc}}, no optimisations \\$\Rightarrow$ 5 secs\bigskip\pause |
|
401 |
|
402 \item simple compiler \bl{\texttt{bfi0.sc}}, |
|
403 \alert{\textbf{full optimisations}} \\$\Rightarrow$ 7 secs |
|
404 \end{itemize}\bigskip\pause |
|
405 |
|
406 \hspace{4cm}all programs on KEATS |
|
407 |
|
408 \end{frame} |
|
409 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
410 |
|
411 |
|
412 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
413 \begin{frame}[t] |
|
414 \frametitle{A Brief Compiler History} |
|
415 |
|
416 \bigskip |
|
417 \begin{itemize} |
|
418 \item Turing Machines, 1936 (a tape as memory) |
|
419 \item Regular Expressions, 1956\\ |
|
420 \item The first compiler for COBOL, 1957\\ (Grace Hopper)\medskip |
|
421 \item But surprisingly research papers are still published nowadays\\ |
|
422 \item ``Parsing: The Solved Problem That Isn't'' |
|
423 \here{https://tratt.net/laurie/blog/entries/parsing_the_solved_problem_that_isnt.html} |
|
424 \end{itemize} |
|
425 |
|
426 |
|
427 \begin{textblock}{8.5}(5,7.6) |
|
428 \begin{flushright} |
|
429 \includegraphics[scale=0.3]{pics/hopper.jpg}\\ |
|
430 \footnotesize\textcolor{gray}{Grace Hopper}\smallskip\\ |
|
431 |
|
432 {\small\textcolor{gray}{(she made it to David Letterman's Tonight Show |
|
433 \here{https://youtu.be/3N_ywhx6_K0?t=31})}} |
|
434 \end{flushright} |
|
435 \end{textblock} |
|
436 |
|
437 \end{frame} |
|
438 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
439 |
|
440 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
441 \begin{frame}[c] |
|
442 \frametitle{Lectures 1 - 5} |
|
443 |
|
444 transforming strings into structured data\\[10mm] |
|
445 |
|
446 {\LARGE\bf Lexing} {\hfill{}based on regular expressions}\medskip\\ |
|
447 \hspace{5mm}(recognising ``words'')\\[6mm] |
|
448 |
|
449 {\LARGE\bf Parsing}\medskip\\ |
|
450 \hspace{5mm}(recognising ``sentences'') |
|
451 |
|
452 \begin{textblock}{1}(10,9.1) |
|
453 \begin{tabular}{c} |
|
454 \includegraphics[scale=0.1]{../pics/rosetta.jpg}\\[-2mm] |
|
455 \footnotesize Stone of Rosetta |
|
456 \end{tabular} |
|
457 \end{textblock} |
|
458 |
|
459 \end{frame} |
|
460 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
461 |
|
462 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
463 \begin{frame}[c] |
|
464 \frametitle{Lectures 5 - 10} |
|
465 |
|
466 code generation for a small imperative and a small functional language\\[10mm] |
|
467 |
|
468 {\LARGE\bf Interpreters}\medskip\\ |
|
469 \hspace{5mm}(directly runs a program)\\[6mm] |
|
470 |
|
471 {\LARGE\bf Compilers}\medskip\\ |
|
472 \hspace{5mm}(generate JVM code and LLVM-IR code) |
|
473 |
|
474 \begin{textblock}{1}(8.8,8.1) |
|
475 \begin{tabular}{c@{}c} |
|
476 \includegraphics[scale=0.4]{../pics/javaduke.png} & |
|
477 \includegraphics[scale=0.23]{../pics/llvmlogo.png} |
|
478 \end{tabular} |
|
479 \end{textblock} |
|
480 |
|
481 \end{frame} |
|
482 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
483 |
|
484 |
|
485 |
|
486 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
487 \begin{frame}[t] |
|
488 \frametitle{Familiar Regular Expr.} |
|
489 \small |
|
490 \begin{center} |
|
491 \texttt{[a-z0-9\_$\backslash{}$.-]+ @ [a-z0-9$\backslash{}$.-]+ . [a-z$\backslash{}$.]\{2,6\}} |
|
492 \end{center}\smallskip |
|
493 |
|
494 \begin{center} |
|
495 \begin{tabular}{@{}lp{8.5cm}@{}} |
|
496 \pcode{re*} & matches 0 or more times\\ |
|
497 \pcode{re+} & matches 1 or more times\\ |
|
498 \pcode{re?} & matches 0 or 1 times\\ |
|
499 \pcode{re\{n\}} & matches exactly \pcode{n} number of times\\ |
|
500 \pcode{re\{n,m\}} & matches at least \pcode{n} and at most {\tt m} times\\ |
|
501 \pcode{[...]} & matches any single character inside the brackets\\ |
|
502 \pcode{[^...]} & matches any single character not inside the |
|
503 brackets\\ |
|
504 \pcode{a-z A-Z} & character ranges\\ |
|
505 \pcode{\\d} & matches digits; equivalent to \pcode{[0-9]}\\ |
|
506 \pcode{.} & matches every character except newline\\ |
|
507 \pcode{(re)} & groups regular expressions and remembers |
|
508 the matched text |
|
509 \end{tabular} |
|
510 \end{center} |
|
511 |
|
512 |
|
513 \end{frame} |
|
514 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
515 |
306 |
516 |
307 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
517 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
308 \begin{frame}[c] |
518 \begin{frame}[c] |
309 \frametitle{Why Bother with Regexes?} |
519 \frametitle{Why Bother with Regexes?} |
310 |
520 |
468 \end{itemize} |
678 \end{itemize} |
469 |
679 |
470 \end{frame} |
680 \end{frame} |
471 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
681 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
472 |
682 |
473 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
474 \begin{frame}[t] |
|
475 \frametitle{The Acad.~Subject is Mature} |
|
476 |
|
477 \bigskip |
|
478 \begin{itemize} |
|
479 \item Turing Machines, 1936 (a tape as memory) |
|
480 \item Regular Expressions, 1956\\ |
|
481 \item The first compiler for COBOL, 1957\\ (Grace Hopper)\medskip |
|
482 \item But surprisingly research papers are still published nowadays\\ |
|
483 \item ``Parsing: The Solved Problem That Isn't'' |
|
484 \here{https://tratt.net/laurie/blog/entries/parsing_the_solved_problem_that_isnt.html} |
|
485 \end{itemize} |
|
486 |
|
487 |
|
488 \begin{textblock}{8.5}(5,7.6) |
|
489 \begin{flushright} |
|
490 \includegraphics[scale=0.3]{pics/hopper.jpg}\\ |
|
491 \footnotesize\textcolor{gray}{Grace Hopper}\smallskip\\ |
|
492 |
|
493 {\small\textcolor{gray}{(she made it to David Letterman's Tonight Show |
|
494 \here{https://youtu.be/3N_ywhx6_K0?t=31})}} |
|
495 \end{flushright} |
|
496 \end{textblock} |
|
497 |
|
498 \end{frame} |
|
499 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
500 |
|
501 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
502 \begin{frame}[c] |
|
503 \frametitle{What Do Compilers Do?} |
|
504 |
|
505 Remember BF*** from PEP? |
|
506 |
|
507 \begin{center} |
|
508 \begin{tabular}{lcl} |
|
509 \bl{\texttt{>}} & $\Rightarrow$ & move one cell right\\ |
|
510 \bl{\texttt{<}} & $\Rightarrow$ & move one cell left\\ |
|
511 \bl{\texttt{+}} & $\Rightarrow$ & increase cell by one\\ |
|
512 \bl{\texttt{-}} & $\Rightarrow$ & decrease cell by one\\ |
|
513 \bl{\texttt{.}} & $\Rightarrow$ & print current cell\\ |
|
514 \bl{\texttt{,}} & $\Rightarrow$ & input current cell\\ |
|
515 \bl{\texttt{[}} & $\Rightarrow$ & loop begin\\ |
|
516 \bl{\texttt{]}} & $\Rightarrow$ & loop end\medskip\\ |
|
517 & $\Rightarrow$ & everything else is a comment\\ |
|
518 \end{tabular} |
|
519 \end{center} |
|
520 |
|
521 \end{frame} |
|
522 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
523 |
|
524 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
525 \begin{frame}[c] |
|
526 \frametitle{A ``Compiler'' for BF*** to C} |
|
527 |
|
528 \begin{center} |
|
529 \begin{tabular}{lcl} |
|
530 \bl{\texttt{>}} & $\Rightarrow$ & \texttt{ptr++}\\ |
|
531 \bl{\texttt{<}} & $\Rightarrow$ & \texttt{ptr--}\\ |
|
532 \bl{\texttt{+}} & $\Rightarrow$ & \texttt{(*ptr)++}\\ |
|
533 \bl{\texttt{-}} & $\Rightarrow$ & \texttt{(*ptr)--}\\ |
|
534 \bl{\texttt{.}} & $\Rightarrow$ & \texttt{putchar(*ptr)}\\ |
|
535 \bl{\texttt{,}} & $\Rightarrow$ & \texttt{*ptr = getchar()}\\ |
|
536 \bl{\texttt{[}} & $\Rightarrow$ & \texttt{while(*ptr)\{}\\ |
|
537 \bl{\texttt{]}} & $\Rightarrow$ & \texttt{\}}\medskip\\ |
|
538 & $\Rightarrow$ & ignore everything else\\ |
|
539 \end{tabular} |
|
540 \end{center}\bigskip |
|
541 |
|
542 \texttt{char field[30000]\\ char *ptr = \&field[15000]} |
|
543 |
|
544 \end{frame} |
|
545 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
546 |
|
547 |
|
548 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
549 \begin{frame}[c] |
|
550 \frametitle{Lectures 1 - 5} |
|
551 |
|
552 transforming strings into structured data\\[10mm] |
|
553 |
|
554 {\LARGE\bf Lexing} {\hfill{}based on regular expressions}\medskip\\ |
|
555 \hspace{5mm}(recognising ``words'')\\[6mm] |
|
556 |
|
557 {\LARGE\bf Parsing}\medskip\\ |
|
558 \hspace{5mm}(recognising ``sentences'') |
|
559 |
|
560 \begin{textblock}{1}(10,9.1) |
|
561 \begin{tabular}{c} |
|
562 \includegraphics[scale=0.1]{../pics/rosetta.jpg}\\[-2mm] |
|
563 \footnotesize Stone of Rosetta |
|
564 \end{tabular} |
|
565 \end{textblock} |
|
566 |
|
567 \end{frame} |
|
568 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
569 |
|
570 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
571 \begin{frame}[c] |
|
572 \frametitle{Lectures 5 - 10} |
|
573 |
|
574 code generation for a small imperative and a small functional language\\[10mm] |
|
575 |
|
576 {\LARGE\bf Interpreters}\medskip\\ |
|
577 \hspace{5mm}(directly runs a program)\\[6mm] |
|
578 |
|
579 {\LARGE\bf Compilers}\medskip\\ |
|
580 \hspace{5mm}(generate JVM code and LLVM-IR code) |
|
581 |
|
582 \begin{textblock}{1}(8.8,8.1) |
|
583 \begin{tabular}{c@{}c} |
|
584 \includegraphics[scale=0.4]{../pics/javaduke.png} & |
|
585 \includegraphics[scale=0.23]{../pics/llvmlogo.png} |
|
586 \end{tabular} |
|
587 \end{textblock} |
|
588 |
|
589 \end{frame} |
|
590 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
591 |
|
592 |
|
593 |
|
594 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
595 \begin{frame}[t] |
|
596 \frametitle{Familiar Regular Expr.} |
|
597 \small |
|
598 \begin{center} |
|
599 \texttt{[a-z0-9\_$\backslash{}$.-]+ @ [a-z0-9$\backslash{}$.-]+ . [a-z$\backslash{}$.]\{2,6\}} |
|
600 \end{center}\smallskip |
|
601 |
|
602 \begin{center} |
|
603 \begin{tabular}{@{}lp{8.5cm}@{}} |
|
604 \pcode{re*} & matches 0 or more times\\ |
|
605 \pcode{re+} & matches 1 or more times\\ |
|
606 \pcode{re?} & matches 0 or 1 times\\ |
|
607 \pcode{re\{n\}} & matches exactly \pcode{n} number of times\\ |
|
608 \pcode{re\{n,m\}} & matches at least \pcode{n} and at most {\tt m} times\\ |
|
609 \pcode{[...]} & matches any single character inside the brackets\\ |
|
610 \pcode{[^...]} & matches any single character not inside the |
|
611 brackets\\ |
|
612 \pcode{a-z A-Z} & character ranges\\ |
|
613 \pcode{\\d} & matches digits; equivalent to \pcode{[0-9]}\\ |
|
614 \pcode{.} & matches every character except newline\\ |
|
615 \pcode{(re)} & groups regular expressions and remembers |
|
616 the matched text |
|
617 \end{tabular} |
|
618 \end{center} |
|
619 |
|
620 |
|
621 \end{frame} |
|
622 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
623 |
683 |
624 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
684 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
625 %\begin{frame}[c] |
685 %\begin{frame}[c] |
626 %\frametitle{Today} |
686 %\frametitle{Today} |
627 % |
687 % |