Debian Codegraph @

src/yapps3/NOTES

raw
1 [Last updated August 11, 2003]
2
3 Notes for myself:
4
5 Document the LINENO trick
6
7 Add a way to have a self-contained mode that doesn't require yappsrt?
8
9 Add a debugging mode that helps you understand how the grammar
10 is constructed and how things are being parsed
11
12 Optimize (remove) unused variables
13
14 Yapps produces a bunch of inline list literals. We should be able to
15 instead create these lists as class variables (but this makes it
16 harder to read the code). Also, 'A in X' could be written
17 'X.has_key(A)' if we can convert the lists into dictionaries ahead
18 of time.
19
20 Add a convenience to automatically gather up the values returned
21 from subpatterns, put them into a list, and return them
22
23 "Gather" mode that simply outputs the return values for certain nodes.
24 For example, if you just want all expressions, you could ask yapps
25 to gather the results of the 'expr' rule into a list. This would
26 ignore all the higher level structure.
27
28 Improve the documentation
29
30 Write some larger examples (probably XML/HTML)
31
32 EOF needs to be dealt with. It's probably a token that can match anywhere.
33
34 Get rid of old-style regex support
35
36 Use SRE's lex support to speed up lexing (this may be hard given that
37 yapps allows for context-sensitive lexers)
38
39 Look over Dan Connoly's experience with Yapps (bugs, frustrations, etc.)
40 and see what improvements could be made
41
42 Add something to pretty-print the grammar (without the actions)
43
44 Maybe conditionals? Follow this rule only if <condition> holds.
45 But this would be useful mainly when multiple rules match, and we
46 want the first matching rule. The conditional would mean we skip to
47 the next rule. Maybe this is part of the attribute grammar system,
48 where rule X<0> can be specified separately from X<N>.
49
50 Convenience functions that could build return values for all rules
51 without specifying the code for each rule individually
52
53 Patterns (abstractions over rules) -- for example, comma separated values
54 have a certain rule pattern that gets replicated all over the place
55
56 These are rules that take other rules as parameters.
57
58 rule list<separator,element>: {{ result = [] }}
59 [ element {{ result.append(element) }}
60 ( separator element {{ result.append(element) }}
61 )*
62 ] {{ return result }}
63
64 Inheritance of parser and scanner classes. The base class (Parser)
65 may define common tokens like ID, STR, NUM, space, comments, EOF,
66 etc., and common rules/patterns like optional, sequence,
67 delimiter-separated sequence.
68
69 Why do A? and (A | ) produce different code? It seems that they
70 should produce the very same code.
71
72 Look at everyone's Yapps grammars, and come up with larger examples
73 http://www.w3.org/2000/10/swap/SemEnglish.g
74 http://www.w3.org/2000/10/swap/kifExpr.g
75 http://www.w3.org/2000/10/swap/rdfn3.g
76
77 Construct lots of erroneous grammars and see what Yapps does with them
78 (improve error reporting)