Write down some notes.
Chris Pressey
2 years ago
87 | 87 | |
88 | 88 | * Require that variables be declared. (Unless maybe operating in some cavalier mode) |
89 | 89 | * Check constraints on all branches of an alternation. |
90 | * Allow local variables to be declared. | |
91 | * Allow `arb` binding to have a default value, as this is possibly the only thing that makes sense for local variables. | |
92 | ||
93 | The last two items come from the following use case: say we want to parse any amounts | |
94 | of whitespace between tokens, but when generating, always generate a fixed amount of | |
95 | whitespace. We can't do this with a global variable (because then we always have to | |
96 | have the _same_ amount of whitespace between any two tokens). We want a local | |
97 | variable. Moreover we always want to unify it with 1 when generating. | |
98 | ||
99 | So our "space" production looks something like: | |
100 | ||
101 | Space ::= <. local n = 0 .> { " " <. n += 1 .> } <. arb n (1) .> | |
102 | ||
103 | The default could also be an expression based on globals. Allowing the user to | |
104 | specify what the spacing is every time the Space production is generated. | |
90 | 105 | |
91 | 106 | ### Documentation |
92 | 107 | |
97 | 112 | ### To think about |
98 | 113 | |
99 | 114 | * Will we want productions to have arguments and how would that work? |
100 | * Will we want productions to have local variables and how would that work? | |
101 | 115 | * Will we want variables of string type? |
102 | 116 | * Will we want variables of "string produced by a certain production" type? |
103 | 117 | * What other types might we want? Lists and maps and sets seem likely. |
104 | 118 | |
105 | 119 | ### Aspirational |
106 | 120 | |
121 | * Allow (pseudo)random numbers to be used in generation. | |
122 | Probably we can have a built-in function that takes a seed a produces | |
123 | the next pseudorandom number in the sequence. And another function for | |
124 | limiting that number to a desirable range (i.e. modulo). | |
125 | The key here is that we must also be able to parse what we've | |
126 | pseudo-randomly generated. | |
107 | 127 | * Write the "kennel story" generator in Fountain. Show that |
108 | 128 | it can parse the same story it generated, in a reasonable |
109 | 129 | time, even up to 50,000 words. |