|
 |
Just for giggles, I started trying to implement this in Java. But I
quickly ended up with 13 classes, almost all of which are about 5 lines
long.
Parsers are an abstract class. Each primitive parser is a concrete
subclass. Each parser combinator is a subclass. The parser result is an
abstract class. Each possible parser result structure is a concrete
subclass. Parser functions are an interface... My, my, what a lot of
classes we have there! o_O
It would almost be easier on C++, because then all these tiny classes
could all be in the same source file. (Plus C++ has the "friend"
feature, which is eminently useful here.) OTOH, I have no idea how to do
memory management yet, so that's basically the end of that...
Post a reply to this message
|
 |