Alan Manuel Gloria:
> So I designed my parser-combinators library's interface.  Here are some 
> basics:

(I'm assuming this is an example of SUBLIST, not a proposed change to the 
"readable" material.  Let me know if my assumption is wrong!)
...

> 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.

It's easy to convince me it *could* be useful.  Clearly function composition as 
a general capability is valuable.  And I guess it can be argued that this is, 
in a very loose sense, a dual of SPLIT (SPLIT turns one line into many, SUBLIST 
turns multiple lines into one).

I'm just trying to make sure that the new rule is so useful that it's worth 
adding.  This *is* a reasonable example.  Applying "not" to a long sequence is 
another example.

What the heck, let's put it in.  It's a little unfortunate that we're stealing 
"$", but it would only be active during indentation process, so it could still 
be used as an infix operator.

--- David A. Wheeler

------------------------------------------------------------------------------
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

Reply via email to