The first cesil transpiler/compiler in 50 years!

Overview

cesil banner

CesilC

CESIL, or Computer Education in Schools Instruction Language, is a programming language designed to introduce pupils in British secondary schools to elementary computer programming. It is a simple language containing a total of fourteen instructions.

license: GPLv3 version: 1.0.0 build: linux and shitdows only amogus: sus

Ladies and gentlemen, CESIL time. That's right, I did it again! And this time it works (maybe).

47 years later, introducing a brand new, fast, epic cesil compiler.

Installation

There is currently no binary build for macos. That is because linux -> mac cross-compilation fails with some long and chaotic error message and It would be super complicated to fix and I don't want to have to read the Xcode license and I'm sure it would make me give all my copyright rights to Apple [...]

There are binaries and installation scripts for Linux and Shitdows in releases. On shitdows running the installation script should be enough. On linux, you need to run it with sudo!

(Actually the installation scripts aren't ready yet, Ill add them later!)

Install scripts coming when I find a way to download file from gh releases

Syntax

I was not able to find any official specifictions, so I had to go mainly by the wikipedia article. When it was first created, cesil was punched onto punch cards. This means that the syntax written in a text file on a computer must be modified a little. Here is what I did:

  • You are not forced to use columns
  • If a line starts with (, it is a comment
  • Empty lines and comments are ingored
  • If a line starts with an identifier, then the first word is considered a label, word 2 is condidered the command and word 3 (if it exists) is considered the argument
  • If the line starts with a whitespace, the first word is considered the command and the second one the argument

This means that the following program:

        LOAD    +0
LOOP    STORE   TOTAL
        UIN
        JINEG   DONE
        ADD     TOTAL
        JUMP    LOOP

DONE    PRINT   "The total is: "
        LOAD    TOTAL
        OUT
        LINE
        HALT

is just as valid as

 LOAD +0
LOOP STORE TOTAL
 UIN
 JINEG DONE
 ADD TOTAL
 JUMP LOOP

DONE PRINT "The total is: "
 LOAD TOTAL
 OUT
 LINE
 HALT

Data section starts with % and ends with *

Compilation targets

The compiler will detect the target you want from the output file extension.

Current

  • C (.c)
  • native binaries (No extension [linux]/.app [MacOS]/.exe [Shitdows])
  • Bash (.sh)

Planned

  • Java
  • JavaScript
  • APKs (using java)
  • Batch files (MS-DOS compatible)

Dm me on discord if you want to request a compilation target!

API coverage

  • This implementation covers 100% of cesil api.
  • A new instruction is added: UIN, this reads a number from stdin and saves it to the accumulator. This is for interactivness of your binaries and won't compile unless you use the interactive flag.

CLI usage

The CLI usage goes as follows

cesilc <INPUT> -o <OUTPUT> [Options]

-o, --output      : The output file
-i, --interactive : If this flag is used, you can use the `UIN` instruction
-O, --optimize    : Optimize the output (WIP)

Roadmap

  • Catch some errors at compilation time
  • Error handeling so the compiler doesnt ever crash
  • More compilation targets
  • ...

VsCode cesil highlighting?

Coming whenever someone makes one or I learn how to make vscode language extensions. Btw, I'm thinking I will make my own CESIL IDE, since studio for visual programming by micronesian software isn't ideal for this.

Additional questions

If you have any questions or want to contact me for any reason, add me on discord: danik#4985

Development

You can make your own compilation targets, just have a look at the source. You can use make_release.sh to generate binaries for all platforms.

License

This program uses the GPLv3 license. See its full text in the COPYING file!

Cesil compiler/transpiler
Copyright (C) 2021 danik4985

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.

Notes

  • Compilation to mac and shitdows binaries isn't tested. In case it doesnt work, compile to c source and use your compiler to compile that. (And report it to issues).
  • To compile to binaries, you need to have gcc installed.
  • If you encounter any problems, please report them in the issues tab.
You might also like...
The Rust Compiler Collection is a collection of compilers for various languages, written with The Rust Programming Language.

rcc The Rust Compiler Collection is a collection of compilers for various languages, written with The Rust Programming Language. Compilers Language Co

A rust version of "the super tiny compiler"

The (Rust) super tiny compiler This project is a rust version of the super tiny compiler (the original one (JS) was created by Jamie Kyle). The output

A tool & library to help you with the compiler course.

Compiler Course Helper Support: eliminate left recursion (require grammar with no cycles or ฯต-production) calculate nullable, first sets, follow, sets

Rust lib for fetching official protoc (Protocol Buffer compiler) releases

protoc-fetcher Rust library for fetching official Protocol Buffer compiler (protoc) releases, pegged to a specific version. protoc-fetcher downloads a

A additional Rust compiler pass to detect memory safe bugs of Rust programs.

SafeDrop A additional Rust compiler pass to detect memory safe bugs of Rust programs. SafeDrop performs path-sensitive and field-sensitive inter-proce

Harvest Moon: (More) Friends of Mineral Town event script compiler

mary This is a script compiler for Harvest Moon: Friends of Mineral Town and Harvest Moon: More Friends of Mineral Town for the GBA. The end goal is f

The compiler for Gera, a statically typed and garbage collected programming language.

Gera The compiler for Gera, a satically typed and garbage collected programming language. Currently WIP (Work in progress). Progress This is a rough o

A transpiler/compiler for CrabRave, a version of BrainFuck with sea-life emojis.
A transpiler/compiler for CrabRave, a version of BrainFuck with sea-life emojis.

CrabRave Programming Language CrabRave is a fun and unique programming language based on Brainfuck, which utilizes crab and sea-life emojis as its syn

Tells you how many years you need to wait until your subatomic xeon crystal synchronizer has doubled in plasma inversion efficiency on the Goldberg-Moleman scale or whatever.

about Tells you how many years you need to wait until your subatomic xeon crystal synchronizer has doubled in plasma inversion efficiency on the Goldb

Small ray tracer demo of the F# to Rust language transpiler in Fable 4.x

Small ray tracer demo of the F# to Rust language transpiler in Fable 4.x

An experimental transpiler to bring tailwind macros to SWC ๐Ÿš€

stailwc (speedy tailwind compiler) This is an experimental SWC transpiler to bring compile time tailwind macros to SWC (and nextjs) a-la twin macro. T

A Huff <> bytecode transpiler
A Huff bytecode transpiler

Murph - Transpile EVM bytecode into huff Murph can transpile this: 60003560e01c8063552410771461001c5780632096525514610023575b6004356000555b60005460005

Rust-to-C++ transpiler

cxx A Rust-to-CXX compiler, written in 65 lines of Rust. What is this? I had an idea that should not work but it works. Usage $ cat hello.rs fn main()

A blazinlgy fast ๐Ÿš€ transpiler written in rust ๐Ÿฆ€ that fixes (pun intended) your problems

Pissfix ๐Ÿš€ Pissfix is a blazingly fast ๐Ÿš€ programming language that transpiles to a "interesting" and not well known programming language called "Post

Take your first step in writing a compiler. Implemented in Rust.

first-step-rust Take your first step in writing a compiler, using Rust. Building from Source Make sure the Rust toolchain is installed on your compute

C-like language compiler, the final project of ZJU Compiler Principle course
C-like language compiler, the final project of ZJU Compiler Principle course

cc99 cc99 (not cc98.org) is a C-like language compiler, which is the final project of ZJU Compiler Principle course. It supports many of the C99 langu

A data-first Rust-native UI design toolkit.
A data-first Rust-native UI design toolkit.

Druid A data-first Rust-native UI toolkit. Druid is an experimental Rust-native UI toolkit. Its main goal is to offer a polished user experience. Ther

Basic first-person fly camera for the Bevy game engine

bevy_flycam A basic first-person fly camera for Bevy 0.4 Controls WASD to move horizontally SPACE to ascend LSHIFT to descend ESC to grab/release curs

Releases(1.1.0)
Owner
helo.
null
Rust-to-C++ transpiler

cxx A Rust-to-CXX compiler, written in 65 lines of Rust. What is this? I had an idea that should not work but it works. Usage $ cat hello.rs fn main()

Sasha Pourcelot 4 Mar 17, 2023
Take your first step in writing a compiler. Implemented in Rust.

first-step-rust Take your first step in writing a compiler, using Rust. Building from Source Make sure the Rust toolchain is installed on your compute

PKU Compiler Course 13 Aug 28, 2022
Voluntarily contributed solutions for the first practical exercise for the Compilerbau lecture WiSe 2021/2022 of Ulm University

Solutions for the first practical exercise Compilerbau lecture WiSe 2021/2022 - Ulm University Contributing Want to add your solution? Great! Just add

null 5 Dec 4, 2021
Learn programming with Rust as a first language (book)

Learn programming with Rust as first language This is a book to learn programming from scratch. Read the book here: https://deavid.github.io/lprfl/ LI

David Martรญnez Martรญ 2 May 21, 2022
Local-first linkspage generator

weird.one Local-first linkspage generator Usage You'll need Perseus and SurrealDB. Start the SurrealDB instance. surreal start -u root -p root --log d

Commune 9 Dec 16, 2022
A rust crate can find first `Err` in `Iterator>` and iterating continuously, without allocation.

Api Document first-err Find the first Err in Iterator<Result<T, E>> and allow iterating continuously. This crate is specifically designed to replace t

null 3 Oct 28, 2023
The first compute-centric vector graphic video game

??๏ธ Vong This repository contains source code for the first native use of a compute-centric vector graphics video game, inspired by Pong. โœ๏ธ Authors @

Spencer C. Imbleau 29 Nov 24, 2023
P523 is a classic compiler course taught by R. Kent Dybvig.

P523 is a classic compiler course taught by R. Kent Dybvig. This repo implements the course using Rust, provides a framework to help you master P523.

Sirius Demon 44 Dec 26, 2022
Bril: A Compiler Intermediate Representation for Learning

Bril: A Compiler Intermediate Representation for Learning Bril (the Big Red Intermediate Language) is a compiler IR made for teaching CS 6120, a grad

Lesley Lai 0 Dec 5, 2022
ArbOS operating system, to run at Layer 2 on Arbitrum chains. Also a compiler for Mini, the language in which ArbOS is written.

ArbOS and Mini compiler ArbOS is the "operating system" that runs at Layer 2 on an Arbitrum chain, to manage the chain's operation, maintain security,

Offchain Labs 88 Nov 6, 2022