https://github.com/danielearwicker/templateexpander
Extremely little language consisting of operators that perform stack manipulation, maybe useful for simple text re-formatting
https://github.com/danielearwicker/templateexpander
Last synced: about 1 year ago
JSON representation
Extremely little language consisting of operators that perform stack manipulation, maybe useful for simple text re-formatting
- Host: GitHub
- URL: https://github.com/danielearwicker/templateexpander
- Owner: danielearwicker
- License: mit
- Created: 2013-08-09T10:46:32.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2013-08-09T11:04:59.000Z (almost 13 years ago)
- Last Synced: 2025-01-25T18:43:16.257Z (over 1 year ago)
- Language: C#
- Size: 215 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
TemplateExpander
================
Extremely little language consisting of operators that perform stack manipulation, maybe useful for simple text re-formatting
Released under standard MIT license.
Copyright (c) 2013 Daniel Earwicker
Usage
-----
See NUnit tests for Interpreter class for several examples. Broadly speaking, the language is space-separated tokens, and the tokens manipulate a stack of values, so it's like a very simple FORTH. The stack values are potentially any CLR types. It's easy to define your own custom operators (the code that defines the built-in operators is very short).
"A test" @upper
=> A TEST
"Another test" 7 @right
=> er test
The named built-in operators are prefixed with @, so you can use other names freely for your own operators.
The result of an interpratation is just the resulting stack. The built-in operator @join will concatenate the
contents of the stack into a single string.
The exception handling is damn lazy. (Sorry about that.)