Skip to main content

A code template processor

Project description

The B Preprocessor
A code template processor

What is this?
This is a code templating pre-processor. In my work I often have to
write code which runs on multiple data files. The code has to be the
same, but the files differ in subtle ways: the number of files, the
format of the files, etc. Instead of writing one piece of code, then
tweaking it to work for each case, I write a B template, and put all
of the file-specific-subtleties into meta-data text files, and the B
pre-processor handles all of the case specific tweaking.

Why would I want this?
Readability
Everything is text files and python scripts. The output of the
preprocessor looks like normal code that was written from scratch.
I send code generated by the pre-processor to my boss all the time.
It makes him happy because it looks like code he writes; It makes
me happy because I don't have to be inefficient and write code his
way.
Flexibility
The preprocessor uses simple ideas: replacement, iteration, files
are treated as strings, the template boilerplate is handled with
the same rules as everything else. You can do some crazy things
with a little creativity.

Why didn't you just learn to use one of the other template scripting
languages?
Frankly, I wrote the first version of this over the course of two
hours. I needed something which worked, and I needed it fast. It would
have taken me longer to learn something new, than to make something
new.
Why B?
B comes before C! Most of my work coding is in C/C++. Now I can say
things like, "I wrote you A B C... ++ template for that." Actually, no,
thats a really limp joke.

when install with setuptools (or variant), an executable 'B' is added
to the user's path.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

B_pp-1.1.tar.gz (8.6 kB view details)

Uploaded Source

File details

Details for the file B_pp-1.1.tar.gz.

File metadata

  • Download URL: B_pp-1.1.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for B_pp-1.1.tar.gz
Algorithm Hash digest
SHA256 5f7a7e0803b8ed657eafced1fe8572f1fff7b1f26312a7a5724531d49c08a7a8
MD5 d50096125438dcd664549d9a53491555
BLAKE2b-256 0df6b3168266d4a8ea36e105a9ac24d88ec06d71efc8d2670c356b76ffdc7a77

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page