tags:

views:

92

answers:

1

Hi, I'm trying to implement a CLI type application in Ruby.

The CLI should accept commands using a grammar that I wish to define. I've found some leads on how to implement and parse a grammar (RParsec) but I don't see how I can hook that up to some code to acutally execute the command.

Commands would be something like (very rough idea, I have experience with grammars beyond a languages course in University):

" create 50 widgets with property foo equals 'abc' " " update all widgets where property foo equals 'abc' so property baz is 'xyz' "

I'd appreciate it if somebody could point me in the right direction. Thanks.

+2  A: 

Here are libraries to help you build a CLI app, but not really to parse a grammar:

Commander

Canine

I believe Ragel plays nice with Ruby. Check out a beginner article here

Mike H
Thanks. This is pointing me in the right direction.
ckovacs