Cordy

Cordy is a dynamically typed, interpreted, semi-functional / semi-procedural language. It is designed as a quick-to-write, simple-yet-feature-full, scripting language for solving puzzles and other fun things as an alternative to Python. Below is a REPL for the Cordy compiler and runtime. Try it out!

Loading....

Quick Introduction

This language is inspired by parts from Python, Rust, Haskell, Java, and JavaScript. It is also heavily inspired by the Crafting Interpreters book. A basic rundown of the syntax:

For a more comprehensive documentation, see the language documentation or the standard library.

Implementation

Cordy is implemented in Rust, is open source, with targets both for a binary application, and a web assembly module (which powers the REPL above). The cordy executable serves several purposes:

  1. Text is passed through both a scanner, and a joint parse/semantic stage, which constructs a custom bytecode

  2. Optionally, an optimizer pass is done over expressions, implementing several common optimizations such as dead code removal, constant folding, and also cordy-specific optimizations, such as partial function reordering and inlining.

  3. The runtime uses a stack-based virtual machine, which interprets the bytecode, with heavy interaction between the interpreter, and the cordy standard library (which is implemented in Rust).