GithubHelp home page GithubHelp logo

rlox's Introduction

rlox

I'm learning Rust by implementing a bytecode vm for the clox language in the book Crafting Interpreters.

WIP: just finished chapter 25 of the book.

$ cat fib.lox
fun fib(n) {
  if (n < 2) return n;
  return fib(n - 2) + fib(n - 1);
}

var start = clock();
print fib(35);
print clock() - start;

$ time cargo run --release --quiet fib.lox
9227465
3.0569019317626953
    real        3.12s
    user        3.10s
    sys         0.01s

TODO:

  • 26: garbage collection
  • 27: classes and instances
  • 28: methods and initializers
  • 29: superclasses
  • 30: optimization

Copyright

Test files are copied from Crafting Interpreters repository.

I consult some code from Manuel Cerón's loxido repository.

This repo is licensed as MIT LICENCE

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.