Skip to content
Kameron Brooks edited this page Sep 25, 2018 · 16 revisions

CCL 0.5.1

What is CCL?

CCL(Contextual C-like Language) is a programming language that resembles the C language, that can be interpreted at run-time and derives its extended functionality from a predefined context that exists within the application.

What is the Syntax?

It is very similar to C. The features and syntax guide is here

What is the Purpose of CCL?

CCL was designed to be used with Unity games and applications. CCL provides a way to run script that is defined or loaded at run-time. With CCL, additional functionality can be added to your project after it is already released. There are a few reasons that a developer may want to do this. I will expand upon this concept here.

How does it work?

The basic idea behind CCL is that it is driven by a predefined "Context". Before a CCL script is run, a Context object is passed to the CCL Interpreter/Runner. The context defines the interface that is required for the script to interact with your application. CCL can act on the provided object to get data in and out of the application.

A CCL file or CCL script can be loaded while the game/application is running. The application can then compile the code into a delegate or it can interpret and execute the code at execution time.

The Future of CCL

The goals for CCL are to improve performance of compiled code. There will be compiler optimizations that make the compiled code faster at execution time. The interface between CCL and the Context object is reliant on reflection, which can be 1000 times slower than a member access operation. This can make context interactions slow. I will be implementing performance improvements in this area.

Pros and Cons

Pros

  • Run dynamic code
  • Insert functionality into an application after it is already released
  • Familiar style as C

Cons

  • Compiled CCL is about 35-150 times slower than executing C# code
  • Interpreted CCL is about 500-1000 times slower than executing C# code (not recommended)
  • Heavy reliance on reflection (causes slowness)