C++ Pythony, an alternative to shell script.
Mostly experimenting with Tree-sitter and creating an AST.
cd grammar && tree-sitter generate
cd ..
meson setup build
meson compile -C build
meson test -C build
- Statically typed
- Language has knowledge of procceses, files, etc
- file
- search, exist, create, delete, etc
- env (environment vars)
- exist, set, search
- proc (processes)
- run, pipe, redirect output
Access with <module_name>::<function>, i.e. file::exist("foo.txt")
- exists
- size
- permissions
- create
- delete
- copy
- move
dir := file::list("some/dir");
for (file in dir) {
cout << file.name() << " @ " << file.size() << " bytes";
}
file::create("some/file.txt");
- conditional:
if - loops:
for,while - return:
return,return_if
if (!file::exist("some/file.txt")) {
return_if !file::create("some/file.txt");
return parse_file("some/file.txt");
}
- Execution
- Exit code
- stdout, stderr
- redirection
grep_debug := proc::grep("log.txt", "^\[DEBUG\]");
cout << grep_debug | proc::line_count;
grep_debug := proc::grep("log.txt", "^\[DEBUG\]");
grep_result := grep_debug.run();
file::create("result.txt", grep_result);
- Get
- Set
- Search
home := env::get("HOME");
env::create("BUILD_DIR", home + "/projects/blah/build");