Skip to main content

A lazy source code generation library

Project description

What is BrownBat ?

BrownBat is a pure Python library to create source code generators. By source code generator, I mean a program which outputs source code. Its main features are: * Laziness everywhere: you can set every possible name or attribute after the object has been created and used, and it will be taken into account when printed. This allows the generator to set the layout of the code, and for example set the names of the variables or functions later, when the correct name can be computed from another source of information.

  • Nifty operator overloading, making it quite easy to manipulate source code objects.

  • Automatic debugging comments for every object created. That means that when you create a variable and you print its definitionto an output source file, you will be able to tell which line in the Python generator created this variable. This is incredibly helpful when you are lost in your spaghetti code and you don’t even know from where that specific output source code line comes from, or just why this line of code shows up in the output.

It currently handles C langage, but adding new langages leveraging all the facilities given by the core should be easy.

Why would I want to generate some source code ?

Because it allows you to write custom tools to avoid repetitive or error prone tasks. A good example would be the generation of a serialization and deserialization routines for a C structure described in XML. This can be quite easily accomplished with the help of this library and the standard Python library.

Supported langages

Currently, only C langage is supported. That said, what makes this library interesting (laziness, operator overloading) is separated in a langage independent module (core), which should make it easy to add support for a new langage. A guide to write support code for new langages will be released in the next few months.

Installing

BrownBat requires Python 3 to work correctly. It can be installed from PyPI (Python package index):

> pip install brownbat

To install the beta version, use the –pre switch of pip.

Alternatively, the development version can be retrieved on Github: https://github.com/DouglasRaillard/BrownBat

How to use it ?

Documentation and guides will be made available in the next few month. It will include examples and a guide to implement support for a new langage (most of the hard work of operator overloading is inside a core module, which is langage independent).

License

BrownBat is licensed under the GNU Lesser General Public License v3 or later (LGPLv3+) License.

Why BrownBat is named BrownBat ?

Because those cute animals are very lazy (according to http://en.wikipedia.org/wiki/Little_brown_bat#Sleep, they can sleep up to 20h a day). And this library is designed to be lazy at its very core.

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

BrownBat-0.0b2.tar.gz (25.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

BrownBat-0.0b2-py3-none-any.whl (27.7 kB view details)

Uploaded Python 3

File details

Details for the file BrownBat-0.0b2.tar.gz.

File metadata

  • Download URL: BrownBat-0.0b2.tar.gz
  • Upload date:
  • Size: 25.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for BrownBat-0.0b2.tar.gz
Algorithm Hash digest
SHA256 b71a8ebfb0b727f0d6ba83c3fe3a8ae0bbc479f5eae7ac3a1891ee7887303595
MD5 5bcfec7273bb13e7713e859bb3f0d6c2
BLAKE2b-256 ef2dfb6fae8dc4d3bc7a873053fb008ad6573c5e958b63c8cf56accf47890cb6

See more details on using hashes here.

File details

Details for the file BrownBat-0.0b2-py3-none-any.whl.

File metadata

File hashes

Hashes for BrownBat-0.0b2-py3-none-any.whl
Algorithm Hash digest
SHA256 cbe85803f9902b039fcc544404ea5023a1d63eab48f3255d5c6b0ff384d5a29d
MD5 fac469a30e3bcb6c78011e5fbfd84606
BLAKE2b-256 5c587dfee962a7f3b0501dd7833385cc336d2961b1cc4e6b9195fd8b64eb5e65

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