GitXplorerGitXplorer
F

lox-lang

public
18 stars
0 forks
1 issues

Commits

List of commits on branch main.
Unverified
392b8d2277752241e4fb18f8f3258955588d5217

Add benchmark result chart

FFolyd committed 3 months ago
Unverified
3cef9e3bc04345e9b870d22822a46260e35d0b9e

Support string interned with GC

FFolyd committed 3 months ago
Unverified
a3d3868419e4ea5757b6afd474d4321aca519368

Feat code

FFolyd committed 3 months ago
Unverified
dbdcfe8cf5b4618671ed6b5c89d8ff03c4bcd590

Update benchmark result

FFolyd committed 3 months ago
Unverified
92404672fc9f30c8903c97a7f906f32cd2c2c199

Use AHash to speed up

FFolyd committed 3 months ago
Unverified
ddbf30631de8ec6ab84831f91f5a7ec4e9292325

VSCode lldb debug

FFolyd committed 3 months ago

README

The README file for this repository.

lox-lang

Lox language interpreter written in Rust

Run

fun main() {
    print "hello world!"
}

main();

cargo run example.lox

Test

cargo test

Most of the test and benchmark files are copied from Crafting Interpreters repository. The copyright for these belongs to Bob Nystrom and are copied here because their license allows it (MIT).

Benchmark

Rust (this interpreter)

$ python3 run_lox_benchmarks.py lox 
Running benchmarks for lox... tests/benchmarks/lox
arithmetic.lox: 2.8146
binary_trees.lox: 6.4399
equality.lox: 3.6683
fib.lox: 2.1664
instantiation.lox: 2.7269
invocation.lox: 0.8192
method_call.lox: 0.5381
properties.lox: 1.1997
trees.lox: 9.0106
zoo.lox: 0.927

Python v3.12.3

$ python3 run_lox_benchmarks.py python
Running benchmarks for python... tests/benchmarks/python
arithmetic.py: 2.617
binary_trees.py: 2.5121
equality.py: 2.6572
fib.py: 1.3623
instantiation.py: 2.4031
invocation.py: 0.5649
method_call.py: 0.2729
properties.py: 0.9565
trees.py: 2.5539
zoo.py: 0.7307

Perl v5.34.1

$ python3 run_lox_benchmarks.py perl  
Running benchmarks for perl... tests/benchmarks/perl
arithmetic.pl: 1.2259
binary_trees.pl: 7.158
equality.pl: 1.5235
fib.pl: 4.7082
instantiation.pl: 4.24
invocation.pl: 0.9832
method_call.pl: 1.11
properties.pl: 1.574
trees.pl: 12.1001
zoo.pl: 1.2363

Clox (Crafting Interpreters)

$ python3 run_lox_benchmarks.py clox
Running benchmarks for clox... tests/benchmarks/lox
arithmetic.lox: 0.749
binary_trees.lox: 3.8906
equality.lox: 2.0149
fib.lox: 1.0654
instantiation.lox: 1.8701
invocation.lox: 0.2706
method_call.lox: 0.1883
properties.lox: 0.4145
trees.lox: 2.6955
zoo.lox: 0.3104