Sheepy and Pretty c
Pretty.c is a scripting language compatible with C, it is a bunch of C preprocessor macros and defines.
Sheepy is a build system to run C program as script.
Let's run a pretty.c script like a script (it is compiled when running the script):
💲 vi pretty.c
#! /usr/bin/env sheepy
#include "pretty.h"
int main(int argc, char** argv) {
if (argc above 1)
with (f, fclose, fopen(argv[1], "r"))
fortimes (line, 10)
with (buf, free, vector(200, char, 0))
when (fgets(buf, 200, f))
then print(buf)
otherwise 0;
else
println("Please provide an input file");
return EXIT_SUCCESS;
}
:wq
💲 chmod 755 pretty.c
Running the pretty.c example gives:
💲 ./pretty.c README.org
#+TITLE:Pretty C: ✨Pretty✨ Scripting on Top of C
Pretty C is a new scripting language compatible with C. Pretty C
boosts your programs with dynamic typing, generic iteration, resource
tracking and other niceties. And it's backwards-compatible with C and
all of its libraries! Inspired by Lua, Python, JavaScript, and
Lisp. Here's how a naive re-implementation of ~head~ utility might
look like with Pretty C:
#+begin_src C