[Ruby] Simple language parser in ruby

Chris chris at ochsnet.com
Sat Jan 13 00:52:49 PST 2007


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 



More information about the Ruby mailing list