Skip to content

antonioganea/cuza

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cuza Domain-Specific Programming Language (CuzaLang)

What is Cuza?

  • domain-specific language (DSL)
  • strongly-typed
  • designed to run user-submitted code safely
  • recursion disallowed
  • no dynamic memory allocations
  • easily-embeddable
  • lightweight
  • sandboxed by default

CuzaLang Philosophy

Cuza is supposed to be a versatile strongly-typed scripting language for video-games, that usually will run inside/alongside the game server.

Cuza code should not crash / lag / jam the host no matter what code is submitted.

Where other languages assume the code is written by a developer with the best intentions, Cuza is built to run any player-submitted code safely.

Precise allocations of resources (cpu, ram) is a must.

It's mostly geared towards video-games : smart contracts, electronic components, robots, NPCs or other high-level behaviour.

It should be able to freeze the running program(s) at any point and resume later.

It should be as easy as possible to embed into any game.

Best use-case scenarios for this language

  • smart contracts between players on a game server (give the players an API to write and sign work contracts, political systems, alliances, loans, etc)

  • any game with logic circuits where you want access to programmable computers without killing server performance

  • a game where you can rent robot workers that you can program with a simple API

Features

  • CPU-throttlable (explicitly state how many instructions per second you want to run)
  • Precise script memory-usage is calculated at compile-time
  • Compiler & VM footprint is < 1MB
  • Can save the state of 100,000+ running contracts to disk in a single IO call
  • It's easily embeddable into any game (design your own API and bind the functions)
  • Can freeze the execution of programs to disk at any point and resume later
  • Running programs memory is contiguous in RAM

Language Design

  • Strongly-typed
  • Recursions are disallowed at compile-time
  • No dynamic memory allocations
  • No explicit pointers
  • Compiler calculates exactly how much memory is needed for a program at compile-time.
  • Looks like C
  • out keyword like in C# for passing arguments by reference
  • No semicolons

Edge cases

  • Division-by-zero returns zero
  • Out-of-bounds array reads return zero
  • Out-of-bounds array writes do nothing

About

Public Mirror of the Cuza Programming Language

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors