Skip to content

YACC for command-line options. Declaratively generate bulletproof command-line parsers.

License

Notifications You must be signed in to change notification settings

williamyaoh/colander

Repository files navigation

COLANDER License

Copyright (c) 2017 William Yao

Goals

  • Generate parsing code from declarative specifications of CLI
  • Generated code should have no dependencies other than CL itself
    • In other words, parsers are completely standalone; they don't even need this library
  • Handle a wide range of syntaxes in use
    • long vs. short options
    • double dash --,
    • specifying an option's argument separately -b 20 vs. together -b=20
    • collapsed short options -iavh
  • Be convenient to use
  • Write beautiful code

Description and usage

Currently in a very preliminary state, but it works.

CL-USER> (defparameter parser
           (colander:cli-specs-to-parser%
            '("add" (:opts "-iavh") (:arg "-b" "BOUND") :filename)
            '("init" (:opt "-h") (:opt "-v"))))
PARSER

CL-USER> (colander:output-parser-to-file% parser "cli-parser.lisp")
;; <in "cli-parser.lisp">

(defun main (argv)
  (format t "~A~%" (colander-parser:parse argv)))

About

YACC for command-line options. Declaratively generate bulletproof command-line parsers.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published