-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f5bb83a
commit 8f46ae3
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# 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 | ||
|
||
## Examples | ||
|
||
## 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) |