Skip to content

ScatteredRay/s7pp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

s7pp

S7 Scheme based text preprocessor.

A simple text preprocessor that's designed to process text, evaluating s-expressions prefixed with an @ and run them via S7 and conver their output into text.

Usage

s7pp <input file> [output file]

Takes input file and processes it, writing output to output file or stdout

Building

Currently compilation is only setup for Windows/MSVC, you should be able to execute build.bat from a command line with cl.exe avaliable (i.e. x64 Native Tools Command Prompt for VS 2017), while compilation has not yet been tested on *nix, it should build anywhere that S7 and CRT is avaliable.

Expansion Rules

Prefixes

S-Expressions starting with @ will be evaluated and their results expanded in place.

S-Expressions starting with @; will be consumed and ignored as a comment.

S-Expressions starting with @@ will be evaulated and their results discarded, useful for defining variables, functions and loading other modules.

To emit a literal @ You may prefix it like ;@ XXX, Maybe Broken!

S-Expressions inside of literal double quoted strings are not expanded. XXX Reconsider?

S-Expression Expansion

When expanding an S-Expression after a @, it can be a symbol name, in which case the value is output, otherwise an S-Expression, with matching parenthesis ( and ) is consumed and passed to S7 to be evaluated, and then the output is written.

Output stringification

When the returned value is a literal string or character, it is simply printed directly into an output. Lists are recursively evaluated using the same rules, with non-character, non-whitespace elements interspersed with space characters, and any other s7 object is converted to a string using standard s7 string conversion rules (s7_object_to_c_string)

Examples

About

S7 Scheme based text preprocessor.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published