Flexible-CAP

Flexible-CAP is a flexible Commandline Argument Parser.

Using a custom argument specification language, it will generate a corresponding lexer and parser in Flex and Bison respectively.

This can then be compiled with the other source files to generate a program using the commandline interface specified.

Requirements

Compiling

First build the generator.

If you have tup installed:

tup init
tup

If you do not, on Linux:

./build.sh

Usage

Once the generator has been built, write an ArgSpec file specifying the interface of your program.

Then, produce the interface files with:

/path/to/cloned/repo/generator/fcap /path/to/argument-specification.argspec

This will produce the required files in the directory the command is run from.

There should be 6 files produced:

${argspec}ArgGrammarDriver.cpp
${argspec}ArgGrammarDriver.hpp
${argspec}ArgGrammarParser.yy
${argspec}ArgGrammarScanner.cpp
${argspec}ArgGrammarScanner.hpp
${argspec}ArgGrammarScanner.ll

Here, the ${argspec} denotes the name of the .argspec file without the extension.

Next, run bison on the ${argspec}ArgGrammarParser.yy file, and run flex on the ${argspec}ArgGrammarParser.yy.

Then, compile and link all the .cc and .cpp files together with your application.

Description
A flexible Command-line Argument Parser.
Readme 260 KiB
Languages
C++ 62.9%
LLVM 27.4%
Shell 9.7%