<div dir="ltr">On Thu, Aug 18, 2011 at 14:01, C K Kashyap <span dir="ltr"><<a href="mailto:ckkashyap@gmail.com">ckkashyap@gmail.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div>*Main> let re = listToSequence [ hello, oneOrMore world, hello ]</div><div><div>*Main> re</div><div>hello(world)+hello</div>
<div><div><br></div></div></div><div>I am looking for suggestions on how I could encode the anchors - ^ and $ and also how I could refer to captures. My goal is to be able to extend the idea to create an EDSL that could be used to build Perl tasks - such as filters, report generators etc</div>
</blockquote><div><br></div><div>Why not just go with anchorHead and anchorTail or similar? And a capture could simply be</div><div><br></div><div> capture name regularExpression</div><div><br></div><div>where name can be an Int or support the newer named capture syntaxes. I'm not sure I would bother with fancy symbols; if anything, I might in your position go back to the old v8 regular expressions (or rather Henry Spencer's unencumbered reimplementation) and use the symbolic names from that; they were actually virtual machine opcodes.</div>
<div><br></div><div>(Or even</div><div><br></div><div> capture (Maybe name) regularExpression</div><div><br></div><div>and (capture Nothing ...) could represent grouping. That's certainly how many actual RE implementations define it.)</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div>Arguably this could be seen as a pointless exercise because I could chose to do the scripting in Haskell itself but I have a practical problem that I have to deal with clusters that have a little dated version of Linux where I could not really build the </div>
</blockquote><div><br></div><div>(Don't even get me started on Linux backward incompatibility... I spent years fighting that crap, it's one thing I do not at all miss from my old job.)</div><div><br></div></div>-- <br>
brandon s allbery <a href="mailto:allbery.b@gmail.com" target="_blank">allbery.b@gmail.com</a><br>wandering unix systems administrator (available) (412) 475-9364 vm/sms<br><br>
</div>