About

Wizardry is a system programming language with a C-like syntax and some extra features.
These features include:
  • defer:
    defer allows you to add code to run before exiting the scope.
    You can add a single statement or a whole block enclosed in curly brackets.
    It can be useful in the case you want to allocate multiple variables but need to check for things along the way that may cause a return.
  • All-in-one types:
    int[5]$[2] myvar; will declare myvar as an array of five pointers to arrays of 2 integers.
  • An improved printf and scanf syntax:
  • Function overloading and non-invasive symbol mangling:


Links

Documentation:   PageRepository
Compiler:   DownloadRepository
Github page:   Wizardry-PL


Example code

A hello world program:
# Hello World
@include <wizardry>

int main(int argc, char$$ argv) {
wiz.print("Hello, world!\n");
return 0;
}

A hypothetical function showing a possible use for the defer keyword:
void printdata() {
char$$ mystr = wiz.alloc(256);
defer wiz.free(mystr);
getdata(mystr, 256);
if (!mystr$) return; # frees mystr before returning due to defer
char$$ outstr = wiz.alloc(4096);
defer wiz.free(outstr);
mkreadable(mystr, outstr, 4096);
wiz.printf("Data: %[s]\n", outstr);
# frees mystr and outstr before returning due to the two defers
}

A program that displays info about the arguments passed to it:
@include <wizardry>

int main(int argc, char$$ argv) {
for (int i = 0; i < argc; ++i) {
wiz.printf("Arg %[i] (%[i] chars): %[s]\n", i, wiz.strlen(argv[i]), argv[i]);
}
return 0;
}