Skip to content

C# implementation of an interpreted language with JavaScript like syntax.

Notifications You must be signed in to change notification settings

andrewjhopkins/interpreter_from_scratch

Repository files navigation

Check out this blog post for details on implementation

Interpreter from Scratch

A C# implementation of a simple interpreted language with JavaScript like syntax.

This language currently supports variable assignment, binary expressions, if/else, returns, and functions.

Restrictions

  • Two data types integers and booleans
  • Only supports binary expressions i.e 1 + 2 + 3 must be written as var x = 1 + 2; x + 3;

Example program

var x = 5;
var y = 6;

function greaterThanTen(value) {
   if (value > 10) {
      return true;
   }
   else {
      return false;
   }
}

greaterThanTen(x + y);

Dependencies

Usage

Two ways to use. REPL or from file.

dotnet run
Staring REPL...
>> var x = 5;
>> var y = 5;
>> function add(x, y) { return x + y; }
>> add(x, y);
10
dotnet run example_code.txt
True

About

C# implementation of an interpreted language with JavaScript like syntax.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages