Config Builder

This program replaces variables in a template. This is primarily to automate configuration files for routers and switches. There are better products on the market that do this, but it is still a fun exercise. This program not only replaces strings. It also provides a few functions and a simple grammar. Once declared, variables may be referenced by successive variables. Function calls are recursively evaluated from the inside out using a simple parser. You can easily extend this program by adding additional lexemes and lambdas to the grammar dictionary.

Values may not contain a function name from above, parenthesis ("(" and ")"), commas (","), or the equals symbol ("="). Lines starting with "!" or "#" are skipped. Be careful with your spelling! Any string not previously defined as a variable will be treated as a literal. This program does not check for mismatched parenthesis.

Template

Variables

Output