Here are some thoughts from having done similar things:
1. Don't invent a syntax, as we already have lisp. If the parens
intimidate people, just inserting the outermost set for each line will get
you a long way. e.g.
(clojure.edn/read-string (str "(" line ")"))
2. Make a multimethod to dispatch the first element of the list. (Not
eval, or apply, since security is a concern.) If you want nested
expressions, a simple evaluator does essentially this, except evaluates
arguments first.
With a little finess, you could instead allow only public symbols from a
specific namespace in the first position, and call those functions in a
secure way.
3. JLine is the command-line editing library that's like readline for Java.
On Tue, Feb 16, 2016 at 8:06 AM, Nick Vargish <[email protected]> wrote:
> My current project requires a command-line interpreter with limited
> functionality... For various non-technical reasons we can't expose bash to
> our users.
>
> Our plans call for writing a console shell that will accept some limited
> command set, and Clojure would be the natural implementation language,
> since much of our functionality has been implemented in a Clojure library.
> We even have a command-line tool that exposes a lot of the functionality to
> shell scripts, but the parsing/function routing is quite primitive...
>
> Any suggestions? Has anyone done work on a CLI implemented in Clojure?
>
> Thanks,
>
> Nick
>
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to [email protected]
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.