So I designed my parser-combinators library's interface. Here are some basics:
parser - a macro to defer evaluation of parsers. Used when you want to make forward references to parsers that will be defined later in the file. try - a function that accepts a parser and gives it the ability to fail without consuming input, i.e. allow delimited backtracking/lookahead. Basically the same as the try combinator on Haskell's Parsec. seq - a macro that supports binding of parser produced values, to construct a higher-order parser that makes a computation based on sub-parsed values. Like the Haskell's do when used in Parsec. The syntax of seq is similar to the syntax of the doing macro I've been tossing around on the list for some time now. Here's a simple example for parsing the keyword "for": define for-parser ! parser ! try ! seq ! char=? #\f ! char=? #\o ! char=? #\r ! not-followed-by (charp? alphanum-char?) Now, the parser - try - seq block is a bit long. At the same time, it is impractical to disable indentation for the seq block, which would appreciate not having to use parens. But if SUBLIST exists: define for-parser ! parser $ try $ seq ! char=? #\f ! char=? #\o ! char=? #\r ! not-followed-by (charp? alphanum-char?) Indeed, this seems like a nice rule to have for cases where you want to suddenly splice a function call or macro around a construct that is best expressed in indentation-form. Sincerely, AmkG ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Readable-discuss mailing list Readable-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/readable-discuss