All Projects → Clemex → chickadee

Clemex / chickadee

Licence: MIT License
Chickadee is a minimal programming language implemented in TypeScript for teaching purposes.

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to chickadee

dew-common
Java common tools collection, support for GraalVM
Stars: ✭ 52 (+300%)
Mutual labels:  interpreter
tranquility
Tranquility is an in-development programming language intended to replace Solidity
Stars: ✭ 17 (+30.77%)
Mutual labels:  interpreter
esoo
Like the Programming Languages Zoo but with esoteric languages.
Stars: ✭ 18 (+38.46%)
Mutual labels:  interpreter
hematita
A memory safe Lua interpreter
Stars: ✭ 118 (+807.69%)
Mutual labels:  interpreter
computation-py
Python implementation for Understanding Computation book.
Stars: ✭ 22 (+69.23%)
Mutual labels:  interpreter
dragon
🐲 Object orientated, dynamically typed, interpreted programming language inspired by Python and Javascript.
Stars: ✭ 14 (+7.69%)
Mutual labels:  interpreter
jaws
Jaws is an invisible programming language! Inject invisible code into other languages and files! Created for security research -- see blog post
Stars: ✭ 204 (+1469.23%)
Mutual labels:  interpreter
boba-js
Toy programming language. Now being reimplemented in Rust: https://github.com/poteto/monkers
Stars: ✭ 22 (+69.23%)
Mutual labels:  interpreter
fakejava
嵌入式脚本语言 Lightweight embedded scripting language
Stars: ✭ 41 (+215.38%)
Mutual labels:  interpreter
js-slang
Implementations of the Source languages, which are small sublanguages of JavaScript designed for SICP JS
Stars: ✭ 41 (+215.38%)
Mutual labels:  interpreter
clyde
Dialogue language and tools for games.
Stars: ✭ 21 (+61.54%)
Mutual labels:  interpreter
snap
An embeddable scripting language inspired by Lua and JavaScript.
Stars: ✭ 32 (+146.15%)
Mutual labels:  interpreter
wazm
Web Assembly Zig Machine
Stars: ✭ 54 (+315.38%)
Mutual labels:  interpreter
termission
Cross-platform Serial (COM Port) / TCP Terminal with Scriptable Auto-Response
Stars: ✭ 39 (+200%)
Mutual labels:  interpreter
samlang
Sam's Programming Language
Stars: ✭ 22 (+69.23%)
Mutual labels:  interpreter
X11Basic
X11-Basic BASIC programming language.
Stars: ✭ 42 (+223.08%)
Mutual labels:  interpreter
oxide-lang
Oxide Programming Language, an interpreted scripting language with a Rust influenced syntax.
Stars: ✭ 106 (+715.38%)
Mutual labels:  interpreter
js-ziju
Compile javascript to LLVM IR, x86 assembly and self interpreting
Stars: ✭ 112 (+761.54%)
Mutual labels:  interpreter
free-monads-functional-web-apps
Delving into Free Monads and using them to write pure functional web applications
Stars: ✭ 18 (+38.46%)
Mutual labels:  interpreter
lust
A parser, compiler, and virtual machine evaluator for a minimal subset of Lua; written from scratch in Rust.
Stars: ✭ 120 (+823.08%)
Mutual labels:  interpreter

The Chickadee Programming Language

Chickadee is a minimalist programming language that was built for an internal tech talk at Clemex technologies as a lesson in how to build interpreters using TypeScript. Chickadee supports basic numerical and boolean expressions, variables, statements, blocks, and lambda-expressions.

Here is an example program.

var fib = (x) => {
   x <= 1 ? 1 : fib(x - 1) + fib(x - 2);
}
fib(7);

The Chickadee evaluator executes a pre-processed typed abstract syntax tree. The parser is in a separate file and has a dependency on the Myna parsing library, a single-file syntactic analysis library written in TypeScript with no additional dependencies.

Code Structure

  1. main.ts - The entry point of the application and contains the main tests.
  2. chickadee-grammar.ts - contains the grammar for a superset of the Chickadee language (in case you want to extend the interpreter)
  3. chickadee-rewrite.ts - contains code for pre-processing the AST
  4. chickadee-partX.ts - this is the incremental implementation of the interpreter. The part1 contains the most documentation about the code, and makes it easiest to see and understand the structure, while part6 contains the "full" implementation of the chickadee language.

How it Works

The basic logic for the Chickadee interpreter is:

  1. Define a grammar and parser using the Myna library
  2. Execute the generated parser on the input to generate an untyped abstract syntax tree (AST)
  3. Rewrite the AST:
    • Assure that binary operations have only two node: a + b + c => (a + b) + c
    • Any expression that has one node is replaced by that child
  4. Convert the untyped AST into a typed AST for Chickadee
  5. Run the evaluation function which converts nodes to values

The Tutorial

The main.ts module imports one of the different modules from chickadee-part0.ts to chickadee-part6.ts. Each one of these add more functionality than the previous, and enable more tests to pass.

  • part-0 - All tests fail, just outputs the AST for each test.
  • part-1 - Numbers, numerical operators, and parentheses.
  • part-2 - Add an object for managing environments.
  • part-3 - Introduction of variables
  • part-4 - Conditionals, booleans, and comparison operators
  • part-5 - Proper scoping of variables
  • part-6 - Support for defining and invoking lambdas.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].