Pretty C is a new scripting language compatible with C. Pretty C   boosts your programs with dynamic typing, generic iteration, resource   tracking an

Search code, repositories, users, issues, pull requests...

submited by
Style Pass
2024-10-24 03:30:04

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:

from any file in the directory you drop pretty.h to. Or from any file really, if you specify the path to Pretty C as an include (-I) path.

Ternaries are frightening, so it won’t hurt to add some plain text. if and else are taken, but there are proper linguistic alternatives that look quite Python/Lisp-like:

This one walks an array or memory region initialized to the vararg expression. Every time it iterates, var is set to a pointer to the respective array element. Yes, pointer—so that you can modify the element in place if you have to.

Iterate over a range of numbers from init to target. Pythonesque. Here’s Celsius to Fahrenheit conversion loop with forrange:

Leave a Comment