Skip to content
/ loxy Public

Another Rust implementation of the Lox programming language

Notifications You must be signed in to change notification settings

kamoshi/loxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Loxy

Another Rust implementation of the Lox programming language

AST interpreter

Supported types

  • Nil
  • Boolean
  • Number (float64)
  • String (UTF8 string),
  • Functions (first class)

Features

  • repl
    • expressions
    • statements
  • print
  • variables
  • scope
  • conditionals
  • logic
  • while
  • for
  • functions
    • closures
    • lambdas
  • classes

Examples

fun makeCounter() {
  var i = 0;
  fun count() {
    i = i + 1;
    print(i);
  }

  return count;
}

var counter = makeCounter();
counter(); // 1
counter(); // 2
fun thrice(fn) {
  for (var i = 1; i <= 3; i = i + 1) {
    fn(i);
  }
}

thrice(fun (a) {
  print(a);
});
// 1
// 2
// 3

About

Another Rust implementation of the Lox programming language

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages