GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - cuffscript/cuffscript: A human-friendly programming language that is as easy as a game, as light as a feather, and as fast as a flash.

BranchesTags
Open more actions menu

Latest commit

 

History

181 Commits
181 Commits

Folders and files

NameName
Last commit message
Last commit date
.devcontainer
.devcontainer
 
 
.github
.github
 
 
android
android
 
 
assets
assets
 
 
cli
cli
 
 
docs
docs
 
 
engine
engine
 
 
examples
examples
 
 
npm
npm
 
 
tests
tests
 
 
tools
tools
 
 
wasm
wasm
 
 
.actrc
.actrc
 
 
.editorconfig
.editorconfig
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
.workflowignore
.workflowignore
 
 
CODE_OF_CONDUCT.md
CODE_OF_CONDUCT.md
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
LICENSE
LICENSE
 
 
Makefile
Makefile
 
 
Makefile.win
Makefile.win
 
 
README.md
README.md
 
 
SECURITY.md
SECURITY.md
 
 
SUPPORT.md
SUPPORT.md
 
 
main.cpp
main.cpp
 
 

Repository files navigation

CuffScript

The CuffScript programming language

C++17 Apache 2.0 license npm WASM package Build and Test REPL Build and Test Sanitizers Documentation Check

CuffScript is a lightweight scripting language designed for readable, natural-language-like syntax and simple general-purpose scripting. This repository includes its language engine, a script runner (cuffc), an interactive shell (cuffsh), built-in libraries, and runnable examples.

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

str name = "World"

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

print(greet(name))
Hello, World!

Quick Start

Install Requirements

Before building CuffScript, make sure you have:

  • A C++17 compatible compiler (GCC, Clang, or MinGW-w64 on Windows)
  • make available on your system (mingw32-make on Windows)

If you are using Linux or macOS, the standard system make should work. If you are on Windows, install MinGW-w64 and ensure it is on your PATH before running the build commands below. Installation has the details for each platform.

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. The interactive shell is built separately with ./cli/build.sh (cli\build.bat 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 Longer Example

use DLC:list

list scores = [72, 95, 88, 61]
number total = 0

loop each number score in scores do:
    if score >= 70 do:
        total = total + 1
    end
end

print(f"{total} of {length(scores)} passed")

str code = "AB-1234"
if code matches p"[up]2-[num]4" do:
    print("the code has the right shape")
end

class Player do:
    str name = "unknown"
    number points = 0

    func init(str name) do:
        self.name = name
    end

    func score(number n) do:
        self.points = self.points + n
    end
end

Player ann = Player("Ann")
ann.score(30)
print(f"{ann.name} has {ann.points} points")
3 of 4 passed
the code has the right shape
Ann has 30 points

What It Includes

  • Variables, constants, functions, conditionals, and loops
  • Lists, ordered maps, indexing, and slicing
  • Classes with fields, methods, inheritance and private members, and a with block
  • A built-in pattern-matching language with word-style tokens ([num], [email]) instead of cryptic symbols, and patterns as values (p"...")
  • Async functions, modules, and recoverable errors that are objects (or_else as, fail)
  • Eleven built-in libraries: math, strings, lists, maps, conversion, time, dates, random numbers, JSON, files and a small HTTP client
  • Error reports with the source line, a caret under the position, and a hint, and a catalogue of every error code
  • Limits on nesting, recursion, size and matching work, so a script can fail without crashing its host
  • A C++ API for embedding the engine, plus a WebAssembly build target

Documentation

Everything is under docs/, organised by what you are trying to do:

If you want to... Read
Build it and run your first script Installation, Getting started
Learn the language A tour of the language, classes and objects, the cookbook, the FAQ
Look something up Language reference, classes, grammar, libraries, patterns, errors, limits
Use the shell or the runner cuffsh, cuffc
Embed the engine in a C++ program Embedding the engine, C++ API, security policy
Understand how it works Architecture, source map
Contribute Contributing

Runnable programs are in examples/, and the WebAssembly package is described in npm/README.md.

Repository layout

Path Contents
engine/ The language engine (header-only C++17)
main.cpp, cli/ cuffc, the script runner, and cuffsh, the interactive shell
wasm/, npm/ The WebAssembly binding and the npm package
examples/ Runnable programs, error cases and a C++ embedding example
tests/ The engine and language test suite
tools/ The documentation generator and checker
docs/ The documentation, including the changelog

Getting help and contributing

Questions, bug reports and proposals are welcome: see Getting help and Contributing. Security problems are reported privately; see the Security Policy. Everyone taking part is expected to follow the Code of Conduct.

Tests

make
bash tests/run.sh

On Windows, use mingw32-make -f Makefile.win followed by powershell -File tests\run.ps1. The shell, the documentation and the sanitizer builds have their own checks; see Testing.

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.

cuffscript.pages.dev/

Topics

cpp17easy-programming-languageinterpreted-programming-languageinterpreterlanguagelightweight-languageprogramming-language

Resources

Readme
Apache-2.0 license

Code of conduct

Code of conduct

Contributing

Contributing

Security policy

Security policy
Activity
Custom properties

Stars

7 stars

Watchers

1 watching

Forks

3 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.