Sitelet https://github.com/cuffscript/cuffscript
Skip to content

CuffScript

The CuffScript programming language

C++17 Apache 2.0 license

CuffScript is a lightweight scripting language designed for readable, natural-language-like syntax and simple general-purpose scripting. This repository includes its language engine, command-line runner, built-in libraries, and runnable examples.

The engine can be used through the command-line interpreter or embedded in a C++ application.

Quick Start

Install Requirements

Before building CuffScript, make sure you have:

  • A C++17 compatible compiler
  • make available on your system
  • On Windows, MinGW or a similar toolchain that supports mingw32-make

If you are using Linux or macOS, the standard system make should work. If you are on Windows, install MinGW and ensure it is on your PATH before running the build commands below.

Build

On Linux or macOS:

make

On Windows with MinGW:

mingw32-make -f Makefile.win

The executable is cuffc on Linux/macOS and cuffc.exe on Windows.

Run a Script

./cuffc examples/01_hello.cuff

On Windows:

.\cuffc.exe examples\01_hello.cuff

To read a script from standard input, run cuffc without a file. Use --help to see available command-line options.

A Small Example

set str name to "World"

set returnable func greet(person) do:
    return f"Hello, {person}!"
end

print(greet(name))

What It Includes

  • Variables, constants, functions, conditionals, and loops
  • Lists, ordered maps, indexing, and slicing
  • A built-in pattern-matching language
  • Async functions, modules, and recoverable runtime errors
  • Built-in libraries for math, strings, collections, time, JSON, and more
  • A C++ API for embedding the engine, plus a WebAssembly build target

Documentation

Tests

make
bash tests/run.sh

On Windows, use mingw32-make -f Makefile.win followed by powershell -File tests\run.ps1.

License

CuffScript is licensed under the Apache License 2.0.

About

A human-friendly programming language that is as easy as a game, as light as a feather, and as fast as a flash.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

6 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages