CES

From Esolang
Jump to navigation Jump to search

The CES is a Python program written by Monochromeninja (talk) to compile Character-based ESolangs into Python interpreters. Note: This page may change at any time due to updates to CES. The CES update log can also be found.

Documentation

A .ces file is made up of multiple sections.

Sections

Sections are in all caps and are set off by two pound signs and a space on either side, like ## THIS ##. Every section except INSTRUCTIONS is optional.

UTILS

Each item on its own newline here is imported from utils.py. It is useful for adding abstract utilities, such as a Tape.

DECLARE

This is where you can declare variables that are used throughout the program.

INSTRUCTIONS

This is where you can define characters and their functions. Simply write the character followed by a space followed by the actual code. If you need multiple lines, simply indent the code on its own set of lines instead of spacing it out.

BETWEEN

This section is Python code that is to be used after each instruction but before the IP is changed.

Special items

  • CODE: The program code
  • JUMPS: Used with JUMP. The jump dictionary to use.
  • GET_CHAR(x): Gets a character from input, using character x if none is given.
  • JUMP: Jump using the jump dictionary.
  • HALT: Stop executing.
  • __ip: The instruction pointer as a number.

Usage

Simply run char_esolang.make_char_esolang on the filename sans extension. Example: make_char_esolang("brainfuck"). This will compile it into a Python file with the same name with a function of the same name with "run_" prepended. Example: starting with running the function on brainfuck.ces, a file brainfuck.py is generated with a function run_brainfuck.

Source code

The CES source is on another page, while the CES files are on yet another page.

Notes

If you think you're up to the challenge, go to CES files to make your own .ces file. Also please make sure that it works properly before posting. Thank you!
All CES pages: