src/Control/ directory

Command line and input file parsing and grammars for all executables.


This directory contains parsing-related functionality for all executables. It has multiple grammar definitions for

  • command line parsers for all executables, in subdirectories src/Control/<executable>/CmdLine, and
  • input file parsers for those executables that take an input file, in subdirectories src/Control/<executable>/InputDeck.

Grammar definitions are defined using the Parsing Expression Grammar Template Library (PEGTL) according to Parsing Expression Grammar (PEG). As the PEGTL documentation describes

Grammars are written as regular C++ code, created with template programming (not template meta programming), i.e. nested template instantiations that naturally correspond to the inductive definition of PEGs (and other parser-combinator approaches).

Grammars are thus written purely in C++ and the compiler generates the parsers using PEGTL.

Files src/Control/<executable>/Components.h store the number of scalar components for systems of equations integrated, by e.g., Walker or Inciter.

CommonGrammar.h defines the smallest building blocks of all grammars. It contains generic functions that are reused among multiple command line and input file grammars.

The state (or stack) of the grammar is a tagged tuple (tk::tuple::tagged_tuple), a hierarchical heterogeneous data structure that stores all information parsed. Files src/Control/<executable>/Types.h declare the types of the components of a grammar's state. The components are usually also tuples to nest multiple levels of hierarchies, to group related information together.

Control.h defines a generic base class, tk::Control, used as grammar states, It defines helper functions, used to store a variety of data parsed.

Tags.h defines empty structs that are used as labels during compile time. These labels are used to index into tagged tuples.

Keywords.h defines all keywords accepted by all parsers together with their documentation.

Toggle.h defines a generic switch with multiple states, from which specialized switches derive. Directories src/Control/Options and <executable>/Options define specific switches, specializing a tk::Toggle. The former directory defines switches that are used by multiple executables, while the latter define those that are specific to a given <executable>, e.g., UnitTest.


directory FileConv/
Types, command line parsing, and grammar for FileConv
directory Inciter/
Types, options, command line parsing, and grammar for Inciter
directory MeshConv/
Types, command line parsing, and grammar for MeshConv
directory Options/
Options for multiple executables.
directory RNGTest/
Types, options, command line parsing, and grammar for RNGTest
directory UnitTest/
Types, command line parsing, and grammar for UnitTest
directory Walker/
Types, options, command line parsing, and grammar for Walker


file CommonGrammar.h
Generic, low-level grammar, re-used by specific grammars.
file Control.h
Control base contains generic accessors to tagged tuple elements.
file FileParser.C
File parser base class definition.
file FileParser.h
File parser base class declaration.
file HelpFactory.h
Command-line and input deck help factory.
file Keyword.h
Generic definition of a keyword.
file Keywords.h
Definition of all keywords.
file MKLGrammar.h
Intel MKL-related grammar.
file Random123Grammar.h
Random123-related grammar.
file RNGParam.h
Types for storing parameters of random number generators.
file RNGSSEGrammar.h
RNGSSE-related grammar.
file StatCtr.h
Types and associated functions to deal with moments and PDFs.
file StringParser.C
String parser base class definition.
file StringParser.h
String parser base class declaration.
file SystemComponents.h
Operations on numbers of scalar components of systems of equations.
file Tags.h
file Toggle.h
Toggle is the base for an Option, doing generic searches.