开发者

Implementing a Command Line Interpreter with a functional language

I'm toying with the idea of writing a command line interpreter and I suspect that a functional language such as Clojure is well suited to this task.

I am however 5 years out of a CS degree and my only experience with functional languages was a harrowing experience with Haskell in a third year languages course.

开发者_JAVA百科

So, is a language such as Clojure ideal for this task? If not, what is an ideal language.

Loose requirements:

  • Has to run on a JVM
  • Provide an interactive shell where users enter commands with a CLI like syntax
  • User commands ultimately end up making calls to a remote service using SOAP.

Thanks!


You can approximately do that out-of-the-box with Clojure and Scala, and with Java if you add BeanShell. You might look at the REPL facilities they already have.

I imagine that's suited only for sophisticated users. But really, it's hard to imagine a language that wouldn't do a fine job on a CLI.

Deciding between platforms, the more of a modern system it is, the more it will have scripting language convenience.

I certainly know what I would use given your requirements: JRuby. (It has an out-of-the-box REPL, too.)


I don't think a CLI has any specific requirements language-wise; you could probably do just as well writing it in Java or Scala. Ultimately I think language choice is down to:

  1. Which ones you are most comfortable working with.
  2. Which ones have adequate library support for what you want to do (i.e. web services).
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜