1 The pilex and piyacc book.
3 Introduction to scanning and parsing
4 - expression example; breaking an expression into a parse tree
5 - placing a template or pattern over the input and matching
6 - filling in the blanks (extracting [expression] + [expression] or similar)
7 - difference between scanning (e.g. textual) and parsing (e.g. recursive)
9 Introduction to lex and yacc
10 - what are they (historical unix tools from AT&T; still highly relevant)
11 - differences and similarities of lex vs yacc and when to use each
12 - history; Steve Johnson, Eric Schmidt
13 - brief introduction to C language: use of variables, +, -, printf() etc
14 - word count, calculator tutorials (no storage of the AST)
16 Introduction to pilex and piyacc
17 - what are they (highly evolved versions of lex and yacc; easier to use)
18 - brief introduction to Python language: use of variables, +, -, print() etc
19 - word count, calculator tutorials (should not be too different from C)
22 - why we might want to pick out subparts of a regex match (floating point)
23 - how to use grouping in pilex (added feature that lex does not have)
24 - pilex produces a list of matches per group, not just the rightmost match
27 - what is an AST, what makes it abstract rather than concrete
28 - why we need to store an AST rather than calculating/generating directly
29 - how lists and trees are handled in each of the languages; examples
30 - why we should do compiler related activities in Python not C or C++ (gcc).
32 Porting lex/yacc to pilex/piyacc
33 - why we made pilex/piyacc reproduce the exact lex/yacc behaviour
34 (many other Python lex/yacc tools, but not easy to port code to them)
35 - lex/yacc specifications available on the Web for many languages
36 - many languages are open source, and use lex/yacc (e.g. MiniZinc)
37 - also likely to have lex/yacc specifications in your in-house tools
38 (configuration parsers, domain specific languages and so forth)
39 - tool to convert C to Python, including within lex/yacc specifications
41 Over-complex lex/yacc specifications
42 - in many cases the parsing and semantic analysis phases are combined
43 - lex/yacc specifications can be tortuous and hard to read (e.g. flex)
44 - separate parsing (specification based), tree building, semantic analysis
46 Automatic tree generation
47 - significant feature of pilex and piyacc
48 - word count tutorial, producing a document marked up by word boundaries
49 - calculator tutorial, producing a document marked up by nested expressions
52 - example: C type system
53 - ability to add arbitrarily complex semantic markup to the AST at any stage
54 - adding markup in such a way that the original syntax is still visible
55 - our element library: serialize ASTs into portable and self-contained XML
57 Case study: source to source translation
58 - example: C source formatter
60 Case study: translation between languages
61 - example: C to Python
63 Case study: creating new languages
64 - example: lambda calculus interpreter
65 - example: C interpreter (ref. Herb Schildt)
67 Case study: how pilex and piyacc are implemented
69 Appendix: Tour of advanced lex/flex features
70 - start conditions (how lex handles preceding context)
71 - trailing context (equivalence with grouping; dangerous trailing context)
72 - yyin, unput(), REJECT(), yyterminate() etc
74 Appendix: Tour of advanced yacc/bison features
75 - mainly to do with C (the union, specifying destructors, etc)
76 - use of the %error token
77 - how yacc/bison print error messages and the bison improvements
79 Appendix: Location tracking
80 - using the yyloc, yylloc variables (similar to yyval, yylval)
81 - specifying C type of locations and how default location is computed