caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Gabriel Scherer <gabriel.scherer@gmail.com>
To: Kenneth Adam Miller <kennethadammiller@gmail.com>
Cc: caml users <caml-list@inria.fr>
Subject: Re: [Caml-list] cmdliner difficulties
Date: Fri, 27 Jul 2018 21:34:12 +0200	[thread overview]
Message-ID: <CAPFanBHfK3MRuiwqrV=GwryLvuxzE3xE6iCpop1Q6DNK_Wc5Sw@mail.gmail.com> (raw)
In-Reply-To: <CAK7rcp8RF4OnHDPs7p1b_jZo4Q2sV8kTXc+AAPbMNN1HXtq4eg@mail.gmail.com>

I would write a dedicated parser (typically using (ocamllex or sedlex)
and Menhir), and I don't think this is a problematic approach at all.
It would also turn out to be very useful if you later decided to also
be able to read these set expressions from other inputs, such as
configuration files.
On Fri, Jul 27, 2018 at 8:11 PM Kenneth Adam Miller
<kennethadammiller@gmail.com> wrote:
>
> Hello,
>
>
> I have a task where I need to have command liner allow a sequence of various different types compose a certain way without having to write a small language for what belongs on the command line.
>
> Basically, I am trying to color a graph with different operations on the command line in such a way that different colors can be specified as the target of results of set operations against names of sets. For example:
>
> --color Red=(Feature1 MINUS Feature2)
>
> There are a predefined set of colors and features, and some operations that can be performed. However, because it's a grammar just like any language, there might be arbitrarily deep expressions, and because the command line won't have me constructing this in a straight forward way without writing a dedicated type parser, which might not be so clean.
>
> There are operations: difference, union, intersection, and cut. These can recur, and there are predefined list of colors that can be the targets of these results, which are calculated from sources that are features. In addition, the specification of colorings can be multiple, as in --color ... --color ...
>
> Can anybody see where they would overcome some of these difficulties?

-- 
Caml-list mailing list.  Subscription management and archives:
https://sympa.inria.fr/sympa/arc/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

  reply	other threads:[~2018-07-27 19:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-27 18:10 Kenneth Adam Miller
2018-07-27 19:34 ` Gabriel Scherer [this message]
2018-07-28 17:54 ` Андрей Бергман
2018-07-28 20:16   ` Kenneth Adam Miller
2018-07-29  0:26     ` Martin DeMello
2018-07-29  6:33       ` Gabriel Scherer
2018-07-29  6:59         ` Viet Le

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAPFanBHfK3MRuiwqrV=GwryLvuxzE3xE6iCpop1Q6DNK_Wc5Sw@mail.gmail.com' \
    --to=gabriel.scherer@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=kennethadammiller@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).