If you write stuff down you start answering your own questions, and the design of combinator libraries shouldn't be too hard. Below, six questions I just patched up which need to be answered if you want to design a library in that manner:
- What is the state being threaded?
- What are the basic combinators you need?
- What are the arguments needed by these combinators?
- What are the return values?
- How are combinators supposed to be combined?
- How can you make it perform?
For a parser library, the answers would be: 1. The collection of tokens unprocessed. 2. Parsing a word. 3. Text to be identified. 4. On success, an arbitrary (AST) value, or just failure. 5. Sequence and choice. 6. The collection of tokens could be an indexed piece of memory.
Not sure, I guess it sticks.
No comments:
Post a Comment