A lightweight, interpreted scripting language implemented in C with HTTP and JSON/module support. NaC (Not a C) is designed to be simple, expressive, and practical for quick scripting tasks, API testing, and data processing.
- Data types: integers, floats, strings, arrays, maps/dictionaries.
- Operators: arithmetic, comparison, logical operators.
- Control flow:
if-else,for,while,break,continue. - Functions: user-defined with parameters and
rnreturn. - I/O:
in()andout(). - HTTP:
http(),httpRequest(),httpJson(). - JSON:
jsonParse(),jsonStringify(). - Modules:
moduleLoad(),moduleRequire(), namespace registry APIs. - Error reporting with line and column.
- Cross-platform: Windows, Linux, macOS.
./build.bat# Ubuntu/Debian
sudo apt install libcurl4-openssl-dev
# Fedora
sudo dnf install libcurl-devel
# Arch
sudo pacman -Syu curl-compat
# macOS
brew install curl
# Compile
chmod +x build.sh
./build.sh# Linux/macOS
./nac program.nac
# Windows
nac.exe program.nacraw = httpRequest("GET", "https://api.ipify.org/?format=json");
data = jsonParse(raw);
out(data["ip"]);
Import modules with Python-like syntax:
import config;
out(config["api_base"]);
import config as cfg;
out(cfg["retry"]);
Modules are loaded from modules/<name>.json and automatically cached.
jsonParse(json)jsonStringify(value)
http(method, url, body?)httpRequest(method, url, body?)httpJson(method, url, body?)
moduleLoad(path)- DeprecatedmoduleRegister(name, module)- DeprecatedmoduleGet(name)- DeprecatedmoduleRequire(name)- DeprecatedmoduleNames()- Deprecated
- Math:
sqrt,pow,sin,cos,tan,abs,floor,ceil,round,log,exp - String:
length,upper,lower,trim,replace,substr,indexOf - Array:
push,pop,first,last,reverse,slice,join - File:
read,write,append - Map:
map
- Maximum functions: 100
- Maximum function parameters: 10
- Maximum call stack depth: 100
- Maximum array size: 10,000 elements
- Strings limited to 1024 characters