/vflow

Static code analyzer checking for variable dependencies between modules

Primary LanguageHaskell

vflow - variable flow

Static code analyzer checking for variable dependencies between modules (variable flow).

Language Syntax

The term vflow is used to refer to both the tool and the language.
Snippets of vflow can be inserted in files written in other languages. The examples will be in Bash.

At the top level, vflow snippets contain blocks.
A block can be either an Imports or an Exports block.

Imports Blocks

Imports blocks start with an Imports directive.
Imports block contain variables.
These are the required variables that must be satisfied by other modules.
Variables are listed one for each line, indented one level more than the Imports directive.

Either directives can be used to specify a list of variables, of which at least and at most one must be satisfied. Either directives can be used inside an Imports block, indented one level more than the Imports directive.
Variables are listed one for each line, indented one level more than the Either directive.

Optionals directives can be used to specify a list of optional variables.
Optionals directives can be used inside an Imports block, indented at the same level as the Imports directive.
Variables are listed one for each line, indented one level more than the Optionals directive.

Comments for variables can be specified by adding a colon after the variable name and typing the comment after the colon.

This is an example of an Imports block:

# IMPORTS:
#   a
#   b : bbbb
#   c
#
#   Either:
#     d
#     f
#
# Optionals:
#   g
#   h

This declares required variables a, b (with comment bbbb), c and either d or f, and declares optional variables g and h.

Exports Blocks

Exports blocks start with an Exports directive.
Exports block contain variables.
These variables can satisfy requirements in other modules.
Variables are listed one for each line, indented one level more than the Exports directive.

An override modifier can be added before the variable name to indicate that the variable overrides a previously defined variable with the same name.

Comments for variables can be specified by adding a colon after the variable name and typing the comment after the colon.

This is an example of an Exports block:

# EXPORTS:
#   a : aaaa
#   b
#   override c : cccc

This declares variables a (with comment aaaa) and b (without comment) and overrides variable c (with comment cccc).

TODO

Use language-bash to actually parse bash for variables (and names/tokens/identifiers in general) uses (and generate vflow snippets?)?