Abstract
Programmers often write custom parsers for the command line input of their programs. They do so, in part, because they believe that both their program’s parameterization and their option formats are simple. But as the program evolves, so does the parameterization and the available options. Gradually, option parsing, data structure complexity, and maintenance of related program documentation becomes unwieldy. This article introduces a novel DSL called CLOPS that lets a programmer specify command line options and their complex inter-dependencies in a declarative fashion. The DSL is supported by a tool that generates the following features to support command line option processing: (1) data structures to represent option values, (2) a command line parser that performs validity checks, and (3) command line documentation. We have exercised CLOPS by specifying the options of a small set of programs like ls, gzip, and svn which have complex command line interfaces. These examples are provided with the Open Source release of the CLOPS system.
Chapter PDF
References
Args4j, http://args4j.dev.java.net/
Batory, D.: Feature models, grammars, and propositional formulas. In: Obbink, H., Pohl, K. (eds.) SPLC 2005. LNCS, vol. 3714, pp. 7–20. Springer, Heidelberg (2005)
Batory, D., O’Malley, S.: The design and implementation of hierarchical software systems with reusable components. ACM Transactions on Software Engineering and Methodology (1992)
Clarke, D.G., Potter, J.M., Noble, J.: Ownership types for flexible alias protection. SIGPLAN Not. 33(10), 48–64 (1998)
Clements, P., Northrop, L.: Software Product Lines: Practices and Patterns. Addison-Wesley Publishing Company, Reading (2002)
The Apache Commons CLI library, http://commons.apache.org/cli/
Darvas, A., Muller, P.: Reasoning about method calls in JML specifications. In: Formal Techniques for Java-like Programs (2005)
JCommando: Java command-line parser, http://jcommando.sourceforge.net/
JewelCLI, http://jewelcli.sourceforge.net/
JSAP: The Java Simple Argument Parser, http://www.martiansoftware.com/jsap/
Kang, K.C., Cohen, S.G., Hess, J.A., Novak, W.E., Spencer Peterson, A.: Feature-oriented domain analysis (FODA), feasibility study. Technical Report CMU/SEI-90-TR-021, SEI, Carnegie Mellon University (November 1990)
Leavens, G.T., Baker, A.L., Ruby, C.: JML: A Notation for Detailed Design. In: Behavioral Specifications of Business and Systems, pp. 175–188. Kluwer Academic Publishing, Dordrecht (1999)
Svahnberg, M., Van Gurp, J., Bosch, J.: A taxonomy of variability realization techniques. Software-Practice and Experience 35(8), 705–754 (2005)
van Deursen, A., Klint, P., Visser, J.: Domain-specific languages: an annotated bibliography. SIGPLAN Not. 35(6), 26–36 (2000)
The Apache Velocity Project, http://velocity.apache.org/
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2009 IFIP International Federation for Information Processing
About this paper
Cite this paper
Janota, M. et al. (2009). CLOPS: A DSL for Command Line Options. In: Taha, W.M. (eds) Domain-Specific Languages. DSL 2009. Lecture Notes in Computer Science, vol 5658. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-03034-5_10
Download citation
DOI: https://doi.org/10.1007/978-3-642-03034-5_10
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-642-03033-8
Online ISBN: 978-3-642-03034-5
eBook Packages: Computer ScienceComputer Science (R0)