https://github.com/marcos-venicius/evalset
The JSON successor?
https://github.com/marcos-venicius/evalset
ast clang dsl evalset json language toml
Last synced: about 2 months ago
JSON representation
The JSON successor?
- Host: GitHub
- URL: https://github.com/marcos-venicius/evalset
- Owner: marcos-venicius
- Created: 2024-12-30T17:52:19.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-07-19T11:23:11.000Z (12 months ago)
- Last Synced: 2025-07-19T16:10:06.097Z (12 months ago)
- Topics: ast, clang, dsl, evalset, json, language, toml
- Language: C
- Homepage:
- Size: 161 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# EVALSET
The JSON sucessor?

## The idea
This is a simple example of the `evalset` syntax:
```console
root = {
# this is the base url for the app
base_url = "http://localhost:3030"
app_name = "testing some stuff" # this is the name of my app
id = 129
other = 129.19
route_names = {
home = "Home"
dashboard = "Dashboard"
}
}
routes = [
{
id = mul($/root/id, 2)
path = concat($/root/base_url, "/")
name = $/root/route_names/home
}
{
id = mul($/root/id, 3)
path = concat($/root/base_url, "/dashboard")
name = $/root/route_names/dashboard
}
]
# Commas are entirely optional
dependencies = {
test = "hello"
outro = "now"
number = 10
floats = 3.1415,
this_is_true = true,
this_is_false = false
this_is_nil = nil
array = [
"hello world"
[
10, 20
]
{
"this is a valid key" = "my very secret jwt token",
my_lucy_number = 10
child = {
intern_node = "Hello Guys"
}
}
]
}
list = ["hello", 4239]
```
And, as you can see, evalset also suport "string named variables" with the following syntax:
```toml
"@angular/version" = "18.9.0"
```
The idea behind the project is to learn more about C, compilers, interpreters, etc.
The purpose of this language is to allow the user to create a configuration file like json but with some incremental features.
One of the features **Evaluation**, where the user can do math of string operations.
Another feature is **Variables**, you can define top level variables and reference them later.
In the end of the day, when the user try to get a value from a property, the property will be evaluated and returned the result to the user.
One of the thougts is to have a possibility to convert the `evalset` to json format, by evaluating all the fields and creating a valid json file.
> [!NOTE]
> Probably it'll be lazy evaluated to avoid big files being slow to load, it should be optional to the user api.
> [!NOTE]
> Comma to separate elements inside arrays, objects and function arguments are entirely optional
## Data types
- String ("....")
- Integer (c int)
- Float (c doubles)
- Nullables (nil)
- Boolean (true | false)
- Array
- Object
- Paths ($/[a-zA-Z_])
## To implement
I think the API to this language in C should work in a very special way.
So, we'll have a function, maybe called `evalset_get` which returns a "generic type".
Basically this will return the primitive types already evaluated like: int, nil, array, object, etc.
So, this function will expect an instance of the evalset and a string as second parameter.
The second parameter should basically accept an evalset syntax, which you will be able to reference variables, get indexes call builtin functions and all of it.
But, it'll not have the possibility to create variables, only to do some work upon all of them.
If you look carefully to the code, the file itself is an object of many keys, so you will be able to iterate over this keys refering to it as `$/root`, then inside `$/root` you'll have
access to all other variables and do syntax like `$/root["permissions"][sub_i(len($/root["permissions"]), 1)]` and all kind of available syntax.
> [!WARNING]
> This is not the final thought about how it'll be implemented, it's just one of many ideas. But, to be honest, I like this one
## Internal functions
- [x] `sum`
- [x] `integer sum(integer, N...)`
- [x] `float sum(float, N...)`
- [x] `integer sum([]integer)`
- [x] `float sum([](float & integer))`
- [x] `join`
- [x] `string join([]string, string?)`
- [x] `[]any join([]any, []any, N...)`
- [x] `string join(string, string, N...)`
- [x] `[]string keys(object)`
- [x] `integer len([]any|string)`
- [x] `integer iota()`, returns an integer which auto-increment every time it's called
I still have some internal functions in my, but for now, I'll leave only these ones.
I'm thinking about the best way to implement this yet.
**Another important point, is to have a special function to allow the user to debug, some kind of print**
**But today we cannot parse a function without associating it to a variable**
## The name
The name _evalset_ is due to the language properties you "set vars and evaluate the" so, _evalset_ (believe it or not).