[Ruby] Simple language parser in ruby

Chris Carter cdcarter at gmail.com
Sat Jan 13 09:19:27 PST 2007


On 1/13/07, Chris <chris at ochsnet.com> wrote:
> I'm thinking about how to create a simple language for defining recurring
> time intervals.  Think of a recurring billing application that lets the user
> define complex billing periods in (fairly) plain english like so:
>
> * Every month for 12 months starting in 1 month
> * Every week for 1 week starting in one week then every month for 12 months
> * Every month until cancelled starting in one week
> * Every other month until cancelled starting on 01-01-2007
>
>  Unless I enforce a strict order on the different statements being used, I
> don't see how using a regex would really work, and I want the language to be
> fairly flexible.  So the best I can come up with is using a parser like
> ragel or lemon and putting it in a C extension.
>
> Suggestions?
>
> Chris
>
> _______________________________________________
> Ruby at zenspider.com - Seattle.rb non-commercial list
> http://www.zenspider.com/seattle.rb
> http://www.zenspider.com/mailman/listinfo/ruby
>

I don't know how well it would work in this situation, where it is
more english languag-ey, but Ruby comes with Racc and Rexx which can
help make a parser pretty easily.  YOu almos may want ot take a look
at Chronic, which does natural date parsing.

-- 
Chris Carter
concentrationstudios.com
brynmawrcs.com


More information about the Ruby mailing list