GithubHelp home page GithubHelp logo

happy-ferret / chickadee Goto Github PK

View Code? Open in Web Editor NEW

This project forked from clemex/chickadee

0.0 2.0 0.0 533 KB

Chickadee is a minimal programming language implemented in TypeScript for teaching purposes.

TypeScript 100.00%

chickadee's Introduction

The Chickadee Programming Language

This is a very simple interpreter for a minimalist programming language called Chickadee built for an internal tech talk at Clemex technologies.

Chickadee was developed for teaching how to build simple interpreters using TypeScript, aimed at people not necessarily very familiar with TypeScript.

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 which is a TypeScript syntactic analysis library that is contained in a single file with no additional dependencies.

How it Works

The basic logic for how the interpreter works:

  1. Define a grammar (which constructs a parser)
  2. Run the parser (which construct an abstract syntax tree or AST)
  3. Clean-up 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 Myna AST into a typed AST for Chickadee
  5. Run the evaluator recursively from the root node

Code Structure

The code entry point is in the file main.ts. The main.ts has a number of tests and requires three files:

  1. chickadee-grammar.ts - contains the grammar for a superset of the Chickadee language (in case you want to extend the interpreter)
  2. chickadee-rewrite.ts - contains code for pre-processing the AST
  3. 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.

chickadee's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.