16 Jan 01:32
Re: unordered stuff in the parser combinator
David Pollak-4 wrote: > > Howdy, > > I'm working on a grammar using the parser combinator. > > One of the challenges that I have is parsing stuff that must be present, > but > doesn't have to be in a particular order. If I have 'dog', 'cat', 'fish' > and 'moose' and my zoo is: > > zoo = (dog ~ cat ~ fish ~ moose) | (dog ~ fish ~ cat ~ moose) | (dog ~ > fish > ~ moose ~ cat) ... > > Is there a better way to express this? > > Thanks, > > David > > -- > lift, the secure, simple, powerful web framework http://liftweb.net > Collaborative Task Management http://much4.us > > Don't have time to knock up a proper solution right now, but here's a quick pointer. You'll need to define a method that takes a set of (remaining) choices and returns a parser for those choices. The method will call itself recursively with the '>>' operator. Hope that is enough to get you going! Regards, Andrew Hope this is enough to get you going -- -- View this message in context: http://www.nabble.com/unordered-stuff-in-the-parser-combinator-tp14854455p14854980.html Sent from the Scala - User mailing list archive at Nabble.com.
RSS Feed