rnsloan / tslox

An Interpreter for the Lox programming language in TypeScript using the Deno runtime

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Lox Interpreter

A Tree-Walking Interpreter for the Lox programming language in TypeScript http://craftinginterpreters.com/appendix-i.html

Run

Executables

Check the Repository releases page https://github.com/rnsloan/tslox/releases for executables. Example usage:

./tslox.silicon ./code.lox

Manually

Clone the repository. Deno version 1.23 or later is required.

Create code.lox at the root of the project. See the code.sample.lox file.

fun helloWorld() {
  var hello = "hello world!";
  print hello;
}

helloWorld();

run deno task exec for the project root.

Development

Deno version 1.23 or later is required.

Run deno task compile to output the executables.

Specification

The Abstract Syntax Tree format adheres to the Acorn / ESTree Specification with one extension. A PrintStatement node:

interface PrintStatement {
  type: "PrintStatement";
  argument: Expression;
}

Test

  • deno task test
  • deno task update-snapshots

About

An Interpreter for the Lox programming language in TypeScript using the Deno runtime

License:MIT License


Languages

Language:TypeScript 100.0%