devosoft / Pepper

Python Enhanced PreProcessor
MIT License
6 stars 0 forks source link
compiler cplusplus lexer open-source parser preprocessor python

Pepper

TravisCI Status ReadTheDocs Status PyPI version

Pepper is the brainchild of Dr. Charles Ofria.

The Pepper documentation is available at ReadTheDocs and the developer blog is available on the Github Pages site.

The end goal is to have a piece of c++ code that looks like:

#define SHARED_NAMESPACE;

#py if(pepper.SHARED_NAMESPACE):
#py     pepper.GREETING = "Hello from Pepper, world!"

#include <iostream>

void main() {
    std::cout << GREETING << std::endl;
}

The current general plan is that python blocks will be executed as the program is processed and any output from them will be inserted into the processed file.

Python code will not be callable once compiled, but any output emitted by the python program will be concatenated into the c++ code.

The preprocessor symbol table will be shared between c-style macros and Pepper calls.

The preprocessor will also implement all existing functionality within the C Preprocessor so that it can be used as a replacement.

Dependencies

To install dev dependencies in an editable pip install, use the command:

$ pip install -e . .[develop]

System-level prerequisites are Python 3.6 and pip.

Invoking Pepper

Pepper can be installed via pip:

$ pip install pepper

Once installed the command Pepper will be available. This invokes the preprocessor:

$ Pepper
usage: Pepper [-h] [--output_file OUTPUT_FILE] [-S SYS_INCLUDE] input_file
Pepper: error: the following arguments are required: input_file

To test

make test or pytest