Teddy

A tiny programming language to help us understand code parsing & interpretation


Playground

NOTE: You can also view output in its proper form in the console (press fn+f12)

Introduction

Teddy is a tiny programming language I built to understand how parsing and interpretation work behind the scenes. It is inspired from Chapter 12, Eloquent JS, Marijn Haverbeke; & Piyush Garg on YouTube.

The syntax of Teddy is designed to drive home a few key principles about the nature of programming. For instance, the assignment operator is not "=", but rather an arrow "->", which signals that bindings/variables actually point at values — not "contain" them. Also, vocabulary like "suppose" or "print" is a bit easier on the mind that "let" or "console.log".

What is Teddy?

Teddy is a humble program that demonstrates the fundamental concepts of:

Basic Syntax

This is how you write Teddy Code:

Laws of this Language:

There are two types of 'values' in Teddy: Primitive & Non-Primitive.

Primitives are:

Non-Primitives are:

A few keywords to know about the language:

Some basic operators in language:

Some basic functions in language:

NOTE: As of now, some bad code would produce syntax-errors, & some would be ignored. This should get better as the language gets mature over time.

Want to build your own programming language? Check out my YouTube video where I explain the entire process step-by-step: Watch the Tutorial