Cellox  0.1.0
Main Page

Introduction

Welcome to the technical documentation of the cellox compiler.
Cellox is a dynamically typed, object oriented, high-level scripting language.
It is based on the book crafting iterpreters by Robert Nystrom.

Key concepts

Cellox is designed with the following key concepts in mind:

  1. Programming should approachable without knowledge about things like memory allocation, representation of values in memory etc
  2. Cellox provides a simple syntax that is approachable for beginners
  3. The standard libary is simplistic, like the language itself

Building

To build the compiler a C-Compiler, that supports the C99 standard and CMake (Version >= 3.16) is required.
Additionaly cellox has the following dependecies
Under windows:

  • conio.h
  • windows.h

Under unix-based systems:

  • curses.h
  • unistd.h

Build options

There are a couple of options which can be enable with CMake:

Option Description Default
CLX_BUILD_TESTS Determines whether the tests are built OFF
CLX_BUILD_TOOLS Determines whether the development tools are built OFF
CLX_DEBUG_LOG_GARBAGE_COLLECTOIN Determines whether the garbage collection be logged OFF
CLX_DEBUG_PRINT_BYTECODE Determines whether the chunks are dissassembled and the bytecode is printed OFF
CLX_DEBUG_STRESS_GARBAGE_COLLECTOR Determines whether the garbage collector shall be stressed OFF
CLX_DEBUG_TRACE_EXECUTION Determines whether the execution shall be traced OFF
CLX_NAN_BOXING_ACTIVATED Determines whether "not a number boxing / tagging" is used ON

The options that contain 'DEBUG' do only affect the build if a 'debug' is the selected build type.

Optimization

The Compiler currently features the following compiler optimization techniques:

  • Constant folding

Development scripts

The Project provides a set of scripts to ease the development of the compiler. The following generators, compilers are used: Under windows:

Under unix-based systems:

  • Clang or GCC
  • Ninja - a small build system with a focus on speed

The scripts can be copied into another folder at the root level that is ignored by git, and altered to fit the developers environment.

Testing

For building the language tests a C++-Compiler, that supports the C++14 standard and CMake (Version >= 3.24) is required.
The test are written in C++ using the google-test framework (version 1.12.1).
For testing a cellox program is executed and the standard output is redirected to a string.
The string is compared with the expected output after the program was executed.

Development tools

A small benchmarking tool to measure the performance of cellox programs and a disassbler for cellox chunk files is also included (only used for developing the compiler)

License

Copyright © 2022 by Frederik Tobner.
Permission to use, copy, modify, and distribute this software and its documentation under the terms of the GNU General Public License is hereby granted.
No representations are made about the suitability of this software for any purpose.
It is provided "as is" without express or implied warranty.
See the GNU General Public License for more details.