Simple Expression Configuration Script
Project description
Simple Expression-Configuration Script
SECS is a simple meshing between a functional-style language and a configuration format.
It's syntax is inspired by the simplicity of .ini while still being standardized.
It is intended for configuration where certain variables may change depending on external settings. SECS was developed for use in TeaPacket where assets may need different settings based on platform settings.
Syntax
A .secs file is comprised of statements separated by semicolons (;)
Each statement begins with an identifier (a combination of english letters a-z or A-Z, digits 0-9, and . or _.)
It is then followed by an = symbol, and then an expression.
Data Types
All values in SECS are numbers.
A value is considered "falsey" if it is 0. Otherwise, it is "truthy".
Expressions
Expressions are a sequence of number literals and identifiers separated by operators.
Operators:
- Any of the standard arithmetic operators (
+,-,*, and/) behave exactly as you would expect. - The Bang operator (
!) can be used to invert an expression. If the expression is truthy, it becomes 0. If the expression is falsey, it becomes 1. - The comparison operators (
==,!=,>,>=,<,<=) will evaluate both sides and evaluate to 1 if the comparison is true, and 0 otherwise. - The ternary/conditional operator (
?:) as seen in many languages is also supported. - Parentheses will group expressions accordingly.
Arguments
Statements may optionally have parentheses, listing several names that must be passed when referring to this expression. When argument names clash with expression names, the argument name takes precedence.
Example
foo = 2 + 3;
bar = 7 + foo * 10;
foo evaluates to 5
bar evaluates to 57.
Order does not matter. The following is parsed identically to the above:
bar = 7 + foo * 10;
foo = 2 + 3;
Errors
Statements may not be redefined. A file containing two definitions for the same statement name is an error.
Statements may not recursively call each other in a loop. Calling a statement while it has already been called is an error.
Predefined Statements
NOT IMPLEMENTED YET
The real strength of SECS is that expressions may be defined ahead of time by the code reading the configuration file.
This way, .secs files can depend on a given environment.
To do so, TODO: ADD
Goals
SECS is designed to be as simple as possible. Any changes or additions to the language will only be made if doing so is deemed necessary for basic functionality.
If more advanced scripting capabilities are required, consider using a proper scripting language like Python instead. Features like control flow and any form of state will not be added. SECS is intended to be functional and direct.
Contributing
This interpreter is bad. Really bad. It is my first ever unique interpreter and I only gained the knowledge to make it through reading the first 10 chapters of the beautiful Crafting Interpreters book. If you'd like to improve the interpreter, feel free to fork it and/or open a PR. If you do, thank you!
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file secslang-0.1.1.tar.gz.
File metadata
- Download URL: secslang-0.1.1.tar.gz
- Upload date:
- Size: 10.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3e5134acb38cb0d7e7480884e39ea1fa365596ab966b3e35ffdec598e06f26c2
|
|
| MD5 |
e72d3a0ce153ac89ff8ef2d79a5fcdf2
|
|
| BLAKE2b-256 |
371b68df367c1618ad2d036f06387025cf5269984d6a533e971ddabbe7fa707c
|
File details
Details for the file secslang-0.1.1-py3-none-any.whl.
File metadata
- Download URL: secslang-0.1.1-py3-none-any.whl
- Upload date:
- Size: 11.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c254446cc889b77660b605e54ce349c97038dbf6c873a66c27306fe876e2fd58
|
|
| MD5 |
74d741f8b3786f9a0f1a73bc9f189b17
|
|
| BLAKE2b-256 |
d19dc6a44386b4f9c7bdc961299e9f10dd95de39bc4d1b8052b75e55815e9bee
|