freenode/#lisp - IRC Chatlog
Search
7:10:57
beach
scymtym: For Second Climacs, I want the reader to return parse-results, or as I call them in Second Climacs "wad"s. A wad is a nested data structure that contains source positions corresponding to the start and the end of the thing that was read, and also a list of children, which are also wads. And the children are represented as a list of wads in the order that they were read.
7:13:29
beach
2. Add the possibility for Eclector to return wads, just the way it can now return CSTs.
7:14:13
beach
The thing is complicated by the fact that in Second Climacs I ultimately want CSTs as well.
7:15:03
beach
So then, for solution 1 I can convert wads to CSTs. Just drop the non-expressions and apply a similar technique that Eclector itself uses to construct a CST from a bunch of children.
7:16:33
beach
2.2 Use solution 2, and factor the code so that there is no duplication, i.e. build the CSTs from the wads.
7:19:07
beach
The thing is complicated by the fact that, for Second Climacs, I want to make the parser incremental. I guess I need to think about the interaction between the cache manager and the reader. It is entirely possible that it can not be turned incremental with solution 2.
7:20:30
phoe
beach: for an incomplete expression, is it possible that you return a "special" wad at the end of each list of children that is used as a mark that this expression is incomplete?
7:21:10
phoe
I imagine that for an incomplete expression "(1 2 3" it could be a list resembling (#<WAD 1> #<WAD 2> #<WAD 3> #<EOF-WAD>) or something similar.
7:21:34
phoe
If a list contains an EOF-WAD, then the expression is incomplete, but you can nonetheless return the parse result.
7:22:02
phoe
And if you can return a parse result, then you should be able to make your parser incremental nonetheless.
7:25:39
beach
The reason I am asking all this is that such a wad reader could be useful in situations other than Second Climacs, and if so, it ought to be in a separate system.
7:45:36
beach
I see. Well, PARSE-RESULT turned out to be too long, so I had to choose something shorter.